| 
Groovy 1.7.9 | |||||||
| FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | PROPERTY | CONSTR | METHOD | DETAIL: FIELD | PROPERTY | CONSTR | METHOD | |||||||
java.lang.Objectgroovy.xml.streamingmarkupsupport.AbstractStreamingBuilder
groovy.xml.StreamingMarkupBuilder
class StreamingMarkupBuilder extends AbstractStreamingBuilder
A builder class for creating XML markup. This implementation uses a StreamingMarkupWriter to handle output.
Example:
System.out << new StreamingMarkupBuilder().bind {
   root {
     a( a1:'one' ) {
       b { mkp.yield( '3 < 5' ) }
       c( a2:'two', 'blah' )
     }
   }
 }
 Will output the following String, without newlines or indentation:  
 <root>
   <a a1='one'>
     <b>3 < 5</b>
     <c a2='two'>blah</c>
   </a>
 </root>
 Note that mkp is a special namespace used to escape
 away from the normal building mode of the builder and get access
 to helper markup methods 'yield', 'pi', 'comment', 'out',
 'namespaces', 'xmlDeclaration' and 'yieldUnescaped'.
 
| Property Summary | |
|---|---|
        def | 
        
            builder
             | 
        
        def | 
        
            commentClosure
            Invoked by calling   | 
        
        def | 
        
            declarationClosure
            Invoked by calling   | 
        
        def | 
        
            encoding
             | 
        
        def | 
        
            noopClosure
            Invoked by calling   | 
        
        def | 
        
            pendingStack
             | 
        
        def | 
        
            piClosure
            Invoked by calling   | 
        
        def | 
        
            tagClosure
             | 
        
        def | 
        
            unescapedClosure
            Invoked by calling   | 
        
        boolean | 
        
            useDoubleQuotes
             | 
        
| Constructor Summary | |
            StreamingMarkupBuilder()
             | 
        |
| Method Summary | |
|---|---|
            def
         | 
        
            bind(def closure)
            Returns a Writable object, which may be used to render the markup directly to a String, or send the output to a stream.  | 
        
            def
         | 
        
            bindNode(def node)
            Convenience method for binding a single node.  | 
        
            def
         | 
        
            getQt()
             | 
        
| Methods inherited from class Object | |
|---|---|
| wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll | 
| Property Detail | 
|---|
def builder
def commentClosure
mkp.comment
     
        
def declarationClosure
mkp.xmlDeclaration
     
        
def encoding
def noopClosure
mkp.yield.  Used to render text to the 
 output stream.  Any XML reserved characters will be escaped to ensure
 well-formedness.
     
        
def pendingStack
def piClosure
mkp.pi
     
        
def tagClosure
def unescapedClosure
mkp.yieldUnescaped.  Used to render 
 literal text or markup to the output stream.  No escaping is done on the
 output.
     
        
boolean useDoubleQuotes
| Constructor Detail | 
|---|
StreamingMarkupBuilder()
| Method Detail | 
|---|
def bind(def closure)
Returns a Writable object, which may be used to render the markup directly to a String, or send the output to a stream.
Examples:
 // get the markup as a string:
 new StreamingMarkupBuilder().bind { div { out << "hello world" } }.toString()
 
 // send the output directly to a file:
 new StreamingMarkupBuilder().bind { div { out << "hello world" } } \
      .writeTo( new File('myFile.xml').newWriter() )
 
     
def bindNode(def node)
bindNode(node) is equivalent to bind{ out << node }.
 Returns a Writable object, which may be used to render the markup directly to a String, or send the output to a stream.
def getQt()
Copyright © 2003-2010 The Codehaus. All rights reserved.