Package org.jdom.input

Examples of org.jdom.input.SAXBuilder.build()


  public static Element build(InputStream in) throws ParseException
  {
   
    try {
      SAXBuilder builder = new SAXBuilder();
          Document doc = builder.build(in);
          return doc.getRootElement();
        } catch (JDOMException e) {
          logger.warn("Cannot parse XML Stream:"+e);
          throw new ParseException(e);
        } catch (IOException e) {
View Full Code Here


    // turn off DTD loading                    
    saxBuilder.setEntityResolver(new NoOpEntityResolver());

    try {
      Document doc = saxBuilder.build(inpSource);
      ChannelIF channel = parse(cBuilder, doc);
      channel.setLocation(baseLocation);
      return channel;
    } catch (JDOMException e) {
      throw new ParseException("Problem parsing " + inpSource.getSystemId() + ": "+ e);
View Full Code Here

    // document reading without validation
    SAXBuilder saxBuilder = new SAXBuilder(false);
    // turn off DTD loading
    saxBuilder.setEntityResolver(new NoOpEntityResolver());
    try {
      Document doc = saxBuilder.build(inpSource);
      return parse(doc);
    } catch (JDOMException e) {
      throw new ParseException(e);
    }
  }
View Full Code Here

      String url ="http://webservice.webxml.com.cn/WebServices/WeatherWS.asmx/getWeather?theCityCode={city}&theUserID=";
      url = url.replace("{city}", URLEncoder.encode(city, "UTF8"));
      HttpURLConnection conn = (HttpURLConnection) new URL(url).openConnection();
      if(conn.getResponseCode()==200) {
        SAXBuilder builder = new SAXBuilder();
          Document doc = builder.build(conn.getInputStream());
          List strings = doc.getRootElement().getChildren();
          String[] sugguestions = getText(strings.get(6)).split("\n");
         
          /*
          四川 成都
View Full Code Here

        SAXBuilder build = new SAXBuilder();
        for(Enumeration<URL> e = getClass().getClassLoader().getResources(
            "META-INF/" + getName() + "-definitions.xml"); e.hasMoreElements(); ) {
            URL u = e.nextElement();
            log.info("Loading property definitions for class "  + getName() + " from " + u);
            Element root = build.build(u).getRootElement();
            if(!root.getName().equals("definitions")) {
                throw new JDOMException("Root element in " + u + " should be <definitions>");
            }
            for(Iterator i = root.getChildren().iterator(); i.hasNext(); ) {
                Element c = (Element)i.next();
View Full Code Here

        }
        for(Enumeration<URL> e = classloader.getResources(
            "META-INF/" + getName() + "-categories.xml"); e.hasMoreElements(); ) {
            URL u = e.nextElement();
            log.info("Loading categories for class "  + getName() + " from " + u);
            Element root = build.build(u).getRootElement();
            if(!root.getName().equals("categories")) {
                throw new JDOMException("Root element in " + u + " should be <categories>");
            }
            for(Iterator i = root.getChildren().iterator(); i.hasNext(); ) {
                Element c = (Element)i.next();
View Full Code Here

        try {

            in = conx.getInputStream();
           
            SAXBuilder sax = new SAXBuilder();
            document = sax.build(in);

            if (!document.getRootElement().getName().equalsIgnoreCase("applications")) {
                throw new JDOMException("Application root element must be <applications>");
            }
View Full Code Here

    Element root = null;

    // XML�����塣
    SAXBuilder builder = new SAXBuilder();
    try {
      Document doc = builder.build(new File(xmlFile));

      // �õ���Ԫ��
      root = doc.getRootElement();
    } catch (JDOMException e) {
      e.printStackTrace();
View Full Code Here

      }

      installer = new ExtensionInstaller(this);
      SAXBuilder sax = new SAXBuilder();
      try {
        doc = sax.build(descriptor);
      } catch (JDOMException jde) {
        jde.printStackTrace();
        throw new ExtensionException(ExtensionException.FAILED_TO_PARSE_DESCRIPTOR, jde);
      } catch (IOException ioe) {
        throw new ExtensionException(ExtensionException.INTERNAL_ERROR, ioe,  "Failed to load descriptor for parsing.");
View Full Code Here

        for (Enumeration<URL> e = getClass().getClassLoader().getResources("META-INF/contextConfig-definitions.xml"); e
                        .hasMoreElements();) {
            URL u = e.nextElement();
            log.info("Loading context property definitions from " + u);
            SAXBuilder build = new SAXBuilder();
            Element root = build.build(u).getRootElement();
            if (!root.getName().equals("definitions")) {
                throw new JDOMException("Root element in " + u + " should be <definitions>");
            }
            for (Iterator i = root.getChildren().iterator(); i.hasNext();) {
                Element c = (Element) i.next();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.