Package org.waveprotocol.wave.model.document.parser

Examples of org.waveprotocol.wave.model.document.parser.SafeXmlPullParser


  /**
   * @param xmlString
   * @return parsed string
   */
  public D parse(String xmlString) {
    SafeXmlPullParser parser;
    try {
      parser = XmlParserFactory.buffered(xmlString);
    } catch (XmlParseException e) {
      throw new RuntimeException("Cannot parse xml: " + xmlString, e);
    }
    // TODO(ohler): This can be an infinite loop.  Fix that.
    while (parser.getCurrentType() != ItemType.START_ELEMENT) {
      parser.next();
    }

    D document =
        factory.create(parser.getTagName(), CollectionUtils.newJavaMap(parser.getAttributes()));
    parseChildren(parser, document, document.getDocumentElement());

    return document;
  }
View Full Code Here


   * @param selectionListener
   * @return new document
   */
  public D parseIntoDocument(
      String xmlString, SelectionParsingListener<N> selectionListener) {
    SafeXmlPullParser parser;
    try {
      parser = XmlParserFactory.buffered(xmlString);
    } catch (XmlParseException e) {
      throw new RuntimeException("Cannot parse xml: " + xmlString, e);
    }

    while (parser.getCurrentType() != ItemType.START_ELEMENT) {
      parser.next();
    }

    D doc = factory.create(parser.getTagName(), CollectionUtils.newJavaMap(parser.getAttributes()));

    parseChildren(parser, selectionListener, doc, doc.getDocumentElement());

    return doc;
  }
View Full Code Here

  /**
   * @param xmlString
   * @return parsed string
   */
  public D parse(String xmlString) {
    SafeXmlPullParser parser;
    try {
      parser = XmlParserFactory.buffered(xmlString);
    } catch (XmlParseException e) {
      throw new RuntimeException("Cannot parse xml: " + xmlString, e);
    }
    // TODO(ohler): This can be an infinite loop.  Fix that.
    while (parser.getCurrentType() != ItemType.START_ELEMENT) {
      parser.next();
    }

    D document =
        factory.create(parser.getTagName(), CollectionUtils.newJavaMap(parser.getAttributes()));
    parseChildren(parser, document, document.getDocumentElement());

    return document;
  }
View Full Code Here

   * @param selectionListener
   * @return new document
   */
  public D parseIntoDocument(
      String xmlString, SelectionParsingListener<N> selectionListener) {
    SafeXmlPullParser parser;
    try {
      parser = XmlParserFactory.buffered(xmlString);
    } catch (XmlParseException e) {
      throw new RuntimeException("Cannot parse xml: " + xmlString, e);
    }

    while (parser.getCurrentType() != ItemType.START_ELEMENT) {
      parser.next();
    }

    D doc = factory.create(parser.getTagName(), CollectionUtils.newJavaMap(parser.getAttributes()));

    parseChildren(parser, selectionListener, doc, doc.getDocumentElement());

    return doc;
  }
View Full Code Here

TOP

Related Classes of org.waveprotocol.wave.model.document.parser.SafeXmlPullParser

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.