Examples of XMLParser


Examples of com.substanceofcode.utils.XmlParser

  throws IOException, CauseException {
        /** Initialize item collection */
        m_rssFeed.getItems().removeAllElements();
       
        /** Initialize XML parser and parse feed */
        XmlParser parser = new XmlParser(is);
       
        /** <?xml...*/
        int parsingResult = parser.parse();
    /** if prologue was found, parse after prologue.  **/
    if (parsingResult == XmlParser.PROLOGUE) {
      parser.parse();
    }
       
        FeedFormatParser formatParser = null;
        String entryElementName = parser.getName();
        if(entryElementName.equals("rss") ||
           entryElementName.equals("rdf")) {
            /** Feed is in RSS format */
            formatParser = new RssFormatParser();
            m_rssFeed = formatParser.parse( parser, m_rssFeed,
View Full Code Here

Examples of com.substanceofcode.utils.XmlParser

    throws IOException, CauseMemoryException, CauseException, Exception {
        /** Initialize item collection */
        Vector rssFeeds = new Vector();
       
        /** Initialize XML parser and parse OPML XML */
        XmlParser  parser = new XmlParser(is);
        try {
           
      // The first element is the main tag.
            int elementType = parser.parse();
      // If we found the prologue, get the next entry.
      if( elementType == XmlParser.PROLOGUE ) {
        elementType = parser.parse();
      }
      if (elementType == XmlParser.END_DOCUMENT ) {
        return null;
      }
           
      EncodingUtil encodingUtil = parser.getEncodingUtil();
            do {
        /** RSS item properties */
        String title = "";
        String link = "";
                       
        String tagName = parser.getName();
        System.out.println("tagname: " + tagName);
        if (tagName.equals("outline")) {
          System.out.println("Parsing <outline> tag");
         
          title = parser.getAttributeValue( "text" );
          if (title != null) {
            title = EncodingUtil.replaceAlphaEntities(true,
                title);
            // No need to convert from UTF-8 to Unicode using replace
            // umlauts now because it is done with new String...,encoding.

            // Replace numeric entities including &#8217;, &#8216;
            // &#8220;, and &#8221;
            title = EncodingUtil.replaceNumEntity(title);

            // Replace special chars like left quote, etc.
            // Since we have already converted to unicode, we want
            // to replace with uni chars.
            title = encodingUtil.replaceSpChars(title);
          }
          /**
           * Create new RSS item and add it do RSS document's item
           * collection.  Account for wrong OPML which is an
           * OPML composed of other OPML.  These have url attribute
           * instead of link attribute.
           */

          if ((link = parser.getAttributeValue( "xmlUrl" )) == null) {
            if (opmlDirectory) {
              link = parser.getAttributeValue( "url" );
            }
          }
         
          /** Debugging information */
          System.out.println("Title:       " + title);
          System.out.println("Link:        " + link);
         
          if(( link == null ) || ( link.length() == 0 )) {
            continue;
          }
          if (( m_feedNameFilter != null) &&
            ((title != null) &&
            (title.toLowerCase().indexOf(m_feedNameFilter) < 0))) {
            continue;
          }
          if (( m_feedURLFilter != null) &&
            ( link.toLowerCase().indexOf(m_feedURLFilter) < 0)) {
            continue;
          }
          RssItunesFeed feed = new RssItunesFeed(title, link, "", "");
          rssFeeds.addElement( feed );
        }
       
      }
            while( parser.parse() != XmlParser.END_DOCUMENT );
           
        } catch (CauseMemoryException ex) {
      rssFeeds = null;
      CauseMemoryException cex = new CauseMemoryException(
          "Out of memory error while parsing OPML feed " +
View Full Code Here

Examples of com.sun.xml.internal.xsom.parser.XMLParser

     */
    private XSSchemaSet createXSOMSpeculative() throws SAXException, SpeculationFailure {

        // check if the schema contains external binding files. If so, speculation is a failure.

        XMLParser parser = new XMLParser() {
            private final JAXPParser base = new JAXPParser();

            public void parse(InputSource source, ContentHandler handler,
                ErrorHandler errorHandler, EntityResolver entityResolver ) throws SAXException, IOException {
                // set up the chain of handlers.
View Full Code Here

Examples of com.sun.xml.xsom.parser.XMLParser

     */
    private XSSchemaSet createXSOMSpeculative() throws SAXException, SpeculationFailure {

        // check if the schema contains external binding files. If so, speculation is a failure.

        XMLParser parser = new XMLParser() {
            private final JAXPParser base = new JAXPParser();

            public void parse(InputSource source, ContentHandler handler,
                ErrorHandler errorHandler, EntityResolver entityResolver ) throws SAXException, IOException {
                // set up the chain of handlers.
View Full Code Here

Examples of de.jochenbrissier.backyard.util.xml.XMLParser

    log.debug("Server: " + server);

    URL url = getClass().getClassLoader().getResource(XML_FILE);

    log.debug("read xml: " + url.getPath());
    XMLParser xml = new XMLParser(url.getPath());

    List<XmlServerNode> nodes = xml.getServers();

    XmlServerNode serverinfo = null;

    for (XmlServerNode node : nodes) {
View Full Code Here

Examples of de.lessvoid.xml.xpp3.XmlParser

      final Nifty nifty) throws Exception {
    try {
      long start = timeProvider.getMsTime();
      log.info("loading new nifty xml file with schemaId [" + schemaId + "]");

      XmlParser parser = new XmlParser(new MXParser());
      parser.read(inputStreamXml);

      NiftyType niftyType = (NiftyType) getSchema(schemaId).loadXml(parser);
      niftyType.loadStyles(this, nifty);
      niftyType.loadControls(this);
View Full Code Here

Examples of de.lessvoid.xml.xpp3.XmlParser

      final String styleFilename,
      final NiftyType niftyType,
      final Nifty nifty) throws Exception {
    log.info("loading new nifty style xml file [" + styleFilename + "] with schemaId [" + schemaId + "]");

    XmlParser parser = new XmlParser(new MXParser());
    InputStream stream = ResourceLoader.getResourceAsStream(styleFilename);
    try {
      parser.read(stream);
      NiftyStylesType niftyStylesType = (NiftyStylesType) getSchema(schemaId).loadXml(parser);
      niftyStylesType.loadStyles(this, niftyType, nifty, log);
    } finally {
      stream.close();
    }
View Full Code Here

Examples of de.lessvoid.xml.xpp3.XmlParser

      final String schemaId,
      final String controlFilename,
      final NiftyType niftyType) throws Exception {
    log.info("loading new nifty controls xml file [" + controlFilename + "] with schemaId [" + schemaId + "]");

    XmlParser parser = new XmlParser(new MXParser());
    InputStream stream = ResourceLoader.getResourceAsStream(controlFilename);
    try {
      parser.read(stream);
      NiftyControlsType niftyControlsType = (NiftyControlsType) getSchema(schemaId).loadXml(parser);
      niftyControlsType.loadControls(this, niftyType);
    } finally {
      stream.close();
    }
View Full Code Here

Examples of de.lessvoid.xml.xpp3.XmlParser

  }

  public void registerSchema(final String schemaId, final InputStream inputStreamSchema) throws Exception {
    try {
      Schema niftyXmlSchema = new Schema();
      XmlParser parser = new XmlParser(new MXParser());
      parser.read(inputStreamSchema);
      parser.nextTag();
      parser.required("nxs", niftyXmlSchema);
      schemes.put(schemaId, niftyXmlSchema);
    } finally {
      inputStreamSchema.close();
    }
  }
View Full Code Here

Examples of de.lessvoid.xml.xpp3.XmlParser

      final XmlParser xmlParser,
      final Attributes attributes) throws Exception {
    String filename = attributes.get("filename");

    Schema niftyXmlSchema = new Schema();
    XmlParser parser = new XmlParser(new MXParser());
    InputStream stream = ResourceLoader.getResourceAsStream(filename);
    try {
      parser.read(stream);
      parser.nextTag();
      parser.required("nxs", niftyXmlSchema);

      types.putAll(niftyXmlSchema.getTypes());
      xmlParser.nextTag();
    } finally {
      stream.close();
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.