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

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


   * @param text
   * @return a DocInitialization
   * @throws XmlParseException
   */
  public static DocInitialization docInitializationFromXml(String text) throws XmlParseException {
    XmlPullParser p = XmlParserFactory.unbuffered(text);
    DocOpBuilder builder = new DocOpBuilder();
    while (p.hasNext()) {
      switch (p.next()) {
        case START_ELEMENT:
          builder.elementStart(p.getTagName(), AttributesImpl.fromStringMap(p.getAttributes()));
          continue;
        case END_ELEMENT:
          builder.elementEnd();
          continue;
        case TEXT:
          builder.characters(p.getText());
          continue;
        case PROCESSING_INSTRUCTION:
          String name = p.getProcessingInstructionName();
          AnnotationBoundaryMapBuilder anBuilder = new AnnotationBoundaryMapBuilder();
          if (PI_TARGET.equals(name)) {
            List<Pair<String, String>> parseAnnotations =
                AnnotationParser.parseAnnotations(p.getProcessingInstructionValue());
            for (Pair<String, String> ann : parseAnnotations) {
              final String key = ann.first;
              final String oldValue = null;
              final String newValue = ann.second;
              if (newValue == null) {
View Full Code Here


   * @param builder
   */
  public static void appendXmlToBuilder(XmlStringBuilder xml, Builder builder) {
    String xmlString = xml.getXmlString();
    try {
      XmlPullParser parser = XmlParserFactory.unbuffered(xmlString);
      while (parser.hasNext()) {
        parser.next();
        switch (parser.getCurrentType()) {
          case TEXT:
            builder.characters(parser.getText());
            break;
          case START_ELEMENT:
            builder.elementStart(parser.getTagName(), new AttributesImpl(CollectionUtils
                .newJavaMap(parser.getAttributes())));
            break;
          case END_ELEMENT:
            builder.elementEnd();
            break;
        }
View Full Code Here

   * @param text
   * @return a DocInitialization
   * @throws XmlParseException
   */
  public static DocInitialization docInitializationFromXml(String text) throws XmlParseException {
    XmlPullParser p = XmlParserFactory.unbuffered(text);
    DocOpBuilder builder = new DocOpBuilder();
    while (p.hasNext()) {
      switch (p.next()) {
        case START_ELEMENT:
          builder.elementStart(p.getTagName(), AttributesImpl.fromStringMap(p.getAttributes()));
          continue;
        case END_ELEMENT:
          builder.elementEnd();
          continue;
        case TEXT:
          builder.characters(p.getText());
          continue;
        case PROCESSING_INSTRUCTION:
          String name = p.getProcessingInstructionName();
          AnnotationBoundaryMapBuilder anBuilder = new AnnotationBoundaryMapBuilder();
          if (PI_TARGET.equals(name)) {
            List<Pair<String, String>> parseAnnotations =
                AnnotationParser.parseAnnotations(p.getProcessingInstructionValue());
            for (Pair<String, String> ann : parseAnnotations) {
              final String key = ann.first;
              final String oldValue = null;
              final String newValue = ann.second;
              if (newValue == null) {
View Full Code Here

   * @param builder
   */
  public static void appendXmlToBuilder(XmlStringBuilder xml, Builder builder) {
    String xmlString = xml.getXmlString();
    try {
      XmlPullParser parser = XmlParserFactory.unbuffered(xmlString);
      while (parser.hasNext()) {
        parser.next();
        switch (parser.getCurrentType()) {
          case TEXT:
            builder.characters(parser.getText());
            break;
          case START_ELEMENT:
            builder.elementStart(parser.getTagName(), new AttributesImpl(CollectionUtils
                .newJavaMap(parser.getAttributes())));
            break;
          case END_ELEMENT:
            builder.elementEnd();
            break;
        }
View Full Code Here

TOP

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

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.