Package org.milyn.yaml.handler

Examples of org.milyn.yaml.handler.YamlToSaxHandler


      // Get a reader for the YAML source...
          Reader yamlStreamReader = yamlInputSource.getCharacterStream();
          if(yamlStreamReader == null) {
              throw new SmooksException("The InputSource doesn't provide a Reader character stream. Make sure that you supply a reader to the Smooks.filterSource method.");
          }
          YamlToSaxHandler yamlToSaxHandler = new YamlToSaxHandler(contentHandler, anchorAttributeName, aliasAttributeName, indent);

          EventHandler eventHandler;
          if(aliasStrategy == AliasStrategy.REFER) {
            eventHandler = new AliasReferencingEventHandler(yamlToSaxHandler);
          } else {
            eventHandler = new AliasResolvingEventHandler(yamlEventStreamParser, yamlToSaxHandler, aliasStrategy == AliasStrategy.REFER_RESOLVE);
          }

          if(logger.isTraceEnabled()) {
            logger.trace("Starting YAML parsing");
          }

          Iterable<Event> yamlEventStream = yaml.parse(yamlStreamReader);

          // Start the document and add the root  element...
          contentHandler.startDocument();

          yamlToSaxHandler.startElementStructure(rootName, null, false);

          yamlEventStreamParser.handle(eventHandler, yamlEventStream);

          yamlToSaxHandler.endElementStructure(rootName);

          contentHandler.endDocument();

        } finally {
          contentHandler = null;
View Full Code Here

TOP

Related Classes of org.milyn.yaml.handler.YamlToSaxHandler

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.