Examples of DocumentStartEvent


Examples of com.esotericsoftware.yamlbeans.parser.DocumentStartEvent

    try {
      if (!started) {
        emitter.emit(Event.STREAM_START);
        started = true;
      }
      emitter.emit(new DocumentStartEvent(config.writeConfig.explicitFirstDocument, null, null));
      isRoot = true;
      writeValue(object, config.writeConfig.writeRootTags ? null : object.getClass(), null, null);
      emitter.emit(Event.DOCUMENT_END_FALSE);
    } catch (EmitterException ex) {
      throw new YamlException("Error writing YAML.", ex);
View Full Code Here

Examples of com.esotericsoftware.yamlbeans.parser.DocumentStartEvent

      }
    };
    table[S_FIRST_DOCUMENT_START] = new EmitterState() {
      public void expect () throws IOException {
        if (event.type == DOCUMENT_START) {
          DocumentStartEvent documentStartEvent = (DocumentStartEvent)event;
          if (documentStartEvent.version != null) {
            if (documentStartEvent.version.major != 1)
              throw new EmitterException("Unsupported YAML version: " + documentStartEvent.version);
            writer.writeVersionDirective(documentStartEvent.version.toString());
          }
View Full Code Here

Examples of com.esotericsoftware.yamlbeans.parser.DocumentStartEvent

    } else if (!indentless) indent += config.indentSize;
  }

  void expectDocumentStart (boolean first) throws IOException {
    if (event.type == DOCUMENT_START) {
      DocumentStartEvent ev = (DocumentStartEvent)event;
      boolean implicit = first && !ev.isExplicit && !config.canonical && ev.version == null && ev.tags == null
        && !checkEmptyDocument();
      if (!implicit) {
        writer.writeIndent(indent);
        writer.writeIndicator("--- ", true, true, false);
View Full Code Here

Examples of com.esotericsoftware.yamlbeans.parser.DocumentStartEvent

    try {
      if (!started) {
        emitter.emit(Event.STREAM_START);
        started = true;
      }
      emitter.emit(new DocumentStartEvent(config.writeConfig.explicitFirstDocument, null, null));
      isRoot = true;
      writeValue(object, config.writeConfig.writeRootTags ? null : object.getClass(), null, null);
      emitter.emit(new DocumentEndEvent(config.writeConfig.explicitEndDocument));
    } catch (EmitterException ex) {
      throw new YamlException("Error writing YAML.", ex);
View Full Code Here

Examples of com.esotericsoftware.yamlbeans.parser.DocumentStartEvent

      }
    };
    table[S_FIRST_DOCUMENT_START] = new EmitterState() {
      public void expect () throws IOException {
        if (event.type == DOCUMENT_START) {
          DocumentStartEvent documentStartEvent = (DocumentStartEvent)event;
          if (documentStartEvent.version != null) {
            if (documentStartEvent.version.major != 1)
              throw new EmitterException("Unsupported YAML version: " + documentStartEvent.version);
            writer.writeVersionDirective(documentStartEvent.version.toString());
          }
View Full Code Here

Examples of com.esotericsoftware.yamlbeans.parser.DocumentStartEvent

    } else if (!indentless) indent += config.indentSize;
  }

  void expectDocumentStart (boolean first) throws IOException {
    if (event.type == DOCUMENT_START) {
      DocumentStartEvent ev = (DocumentStartEvent)event;
      boolean implicit = first && !ev.isExplicit && !config.canonical && ev.version == null && ev.tags == null
        && !checkEmptyDocument();
      if (!implicit) {
        writer.writeIndent(indent);
        writer.writeIndicator("--- ", true, true, false);
View Full Code Here

Examples of org.yaml.snakeyaml.events.DocumentStartEvent

                        key.asJavaString(),
                        value.asJavaString());
            }
        }

        DocumentStartEvent event = new DocumentStartEvent(NULL_MARK, NULL_MARK, implicitBool, versionInts, tagsMap);
        emit(context, event);
        return this;
    }
View Full Code Here

Examples of org.yaml.snakeyaml.events.DocumentStartEvent

                            context,
                            handler,
                            "start_stream",
                            runtime.newFixnum(YAML_ANY_ENCODING));
                } else if (event.is(ID.DocumentStart)) {
                    DocumentStartEvent dse = (DocumentStartEvent)event;

                    Integer[] versionInts = dse.getVersion();
                    IRubyObject version = versionInts == null ?
                        runtime.getNil() :
                        RubyArray.newArray(runtime, runtime.newFixnum(versionInts[0]), runtime.newFixnum(versionInts[1]));
                   
                    Map<String, String> tagsMap = dse.getTags();
                    RubyArray tags = RubyArray.newArray(runtime);
                    if (tags.size() > 0) {
                        for (Map.Entry<String, String> tag : tagsMap.entrySet()) {
                            tags.append(RubyArray.newArray(
                                    runtime,
                                    RubyString.newString(runtime, tag.getKey()),
                                    RubyString.newString(runtime, tag.getValue())));
                        }
                    }

                    invoke(
                            context,
                            handler,
                            "start_document",
                            version,
                            tags,
                            runtime.newBoolean(dse.getExplicit()));
                } else if (event.is(ID.DocumentEnd)) {
                    DocumentEndEvent dee = (DocumentEndEvent)event;
                    invoke(
                            context,
                            handler,
View Full Code Here

Examples of org.yaml.snakeyaml.events.DocumentStartEvent

                        key.asJavaString(),
                        value.asJavaString());
            }
        }

        DocumentStartEvent event = new DocumentStartEvent(NULL_MARK, NULL_MARK, !implicitBool, version, tagsMap);
        emit(context, event);
        return this;
    }
View Full Code Here

Examples of org.yaml.snakeyaml.events.DocumentStartEvent

    private void parseDocument() {
        if (scanner.checkToken(Token.ID.Directive)) {
            scanner.getToken(Token.ID.Directive);
        }
        scanner.getToken(Token.ID.DocumentStart);
        events.add(new DocumentStartEvent(null, null, true, Version.V1_1, null));
        parseNode();
        events.add(new DocumentEndEvent(null, null, true));
    }
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.