Package org.jdom.input

Examples of org.jdom.input.SAXBuilder


   */
  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


   */
  public static ChannelIF parse(ChannelBuilderIF cBuilder, InputSource inpSource,
                                URL baseLocation)
                throws IOException, ParseException {
    // document reading without validation
    SAXBuilder saxBuilder = new SAXBuilder(saxDriverClassName);

    // 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

  }

  public static Collection<FeedIF> parse(InputSource inpSource,
                                URL baseLocation) throws IOException, ParseException {
    // 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

            dataModel.put("zero", new Integer(0));
            dataModel.put("data", new MultiModel1());
        }
       
        else if (testName.equals("nodelistmodel")) {
            org.jdom.Document doc = new SAXBuilder().build(new InputSource(getClass().getResourceAsStream("test-xml.xml")));
            dataModel.put("doc", new NodeListModel(doc));
        }
       
        else if (testName.equals("test-stringbimethods")) {
            dataModel.put("multi", new TestBoolean());
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

        loadPropertyDefinitionsFromResources();
    }
   
   
    void loadPropertyCategoryDefinitionsFromResources(ClassLoader classloader) throws IOException, JDOMException {       
        SAXBuilder build = new SAXBuilder();
        if (classloader == null){
            classloader = getClass().getClassLoader();
        }
        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

            }
        }
    }

    void loadPropertyDefinitionsFromResources() throws IOException, JDOMException {
        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

        InputStream in = null;
        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

   */
  public static Element getRootElement(String xmlFile) {
    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

      if (log.isInfoEnabled()) {
        log.info("Loading bundle from " + getFile().getAbsolutePath());
      }

      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

TOP

Related Classes of org.jdom.input.SAXBuilder

Copyright © 2018 www.massapicom. 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.