- 
     A Groovy builder that works with Stax processors.
 A typical usage is as follows:
  
 import javax.xml.stream.XMLOutputFactory
 def factory = XMLOutputFactory.newInstance()
 def writer = new StringWriter()
 def builder = new groovy.xml.StaxBuilder(factory.createXMLStreamWriter(writer))
 builder.root1(a:5, b:7) {
     elem1('hello1')
     elem2('hello2')
     elem3(x:7)
 }
 assert writer.toString() == 'hello1hello2'
 Or an external library such as Jettison can be used as follows:
 @Grab('org.codehaus.jettison:jettison:1.2')
 import org.codehaus.jettison.mapped.*
 import javax.xml.stream.XMLStreamException
 def conv = new MappedNamespaceConvention()
 def writer = new StringWriter()
 def mappedWriter = new MappedXMLStreamWriter(conv, writer)
 def builder = new groovy.xml.StaxBuilder(mappedWriter)
 builder.root1(a:5, b:7) {
     elem1('hello1')
     elem2('hello2')
     elem3(x:7)
 }
 assert writer.toString() == '''{"root1":{"@a":"5","@b":"7","elem1":"hello1","elem2":"hello2","elem3":{"@x":"7"}}}'''
 - Authors:
- Dejan Bosanac
- Paul King
 
 
    
        - 
        
        
        
        
        
        
        
        
         
                - 
                    Properties Summary
                    
                        Properties 
                        
                            | Type | Name and description |  
                            | def | writer
 |  
 
 
 
                - 
                    Constructor Summary
                    
                        Constructors 
                        
                            | Constructor and description |  
                            | StaxBuilder
                                (def xmlStreamWriter)
 |  
 
 
 
            
            - 
                    Methods Summary
- 
                    Inherited Methods Summary
                    
                        Inherited Methods 
                        
                            | Methods inherited from class | Name |  
                            | class BuilderSupport | invokeMethod, invokeMethod, setProperty, getProperty, getMetaClass, setMetaClass, wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll |  
                            | class GroovyObjectSupport | setProperty, getProperty, invokeMethod, getMetaClass, setMetaClass, wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll |  
 
 
 
 
    
        - 
           
            
            
            
            
            
            
            
            
            
                - 
                    
                
                    Constructor Detail
                            - 
                                StaxBuilder(def xmlStreamWriter)
 
 
                - 
                    
                
                    Method Detail
                            - 
                                protected def createNode(def name)
 
                            - 
                                protected def createNode(def name, def value)
 
                            - 
                                protected def createNode(def name, Map attributes)
 
                            - 
                                protected def createNode(def name, Map attributes, def value)
 
                            - 
                                protected void nodeCompleted(def parent, def node)
 
                            - 
                                protected void setParent(def parent, def child)
 
 
 
    
    
    Copyright © 2003-2019 The Apache Software Foundation. All rights reserved.