groovy.xml
Class MarkupBuilder

java.lang.Object
  extended bygroovy.lang.GroovyObjectSupport
      extended bygroovy.util.BuilderSupport
          extended bygroovy.xml.MarkupBuilder
All Implemented Interfaces:
GroovyObject

public class MarkupBuilder
extends BuilderSupport

A helper class for creating XML or HTML markup

Version:
$Revision: 1.9 $
Author:
James Strachan, Stefan Matthias Aust, Scott Stirling

Field Summary
private  boolean nodeIsEmpty
           
private  boolean nospace
           
private  IndentPrinter out
           
private  int state
           
 
Fields inherited from class groovy.util.BuilderSupport
 
Fields inherited from class groovy.lang.GroovyObjectSupport
 
Constructor Summary
MarkupBuilder()
           
MarkupBuilder(IndentPrinter out)
           
MarkupBuilder(java.io.PrintWriter writer)
           
MarkupBuilder(java.io.Writer writer)
           
 
Method Summary
protected  java.lang.Object createNode(java.lang.Object name)
           
protected  java.lang.Object createNode(java.lang.Object name, java.util.Map attributes)
           
protected  java.lang.Object createNode(java.lang.Object name, java.util.Map attributes, java.lang.Object value)
           
protected  java.lang.Object createNode(java.lang.Object name, java.lang.Object value)
           
protected  java.lang.Object getName(java.lang.String methodName)
          A hook to allow names to be converted into some other object such as a QName in XML or ObjectName in JMX
protected  void nodeCompleted(java.lang.Object parent, java.lang.Object node)
          A hook to allow nodes to be processed once they have had all of their children applied
protected  void print(java.lang.Object node)
           
protected  void setParent(java.lang.Object parent, java.lang.Object child)
           
private  void toState(int next, java.lang.Object name)
           
protected  java.lang.String transformName(java.lang.String name)
           
protected  java.lang.String transformValue(java.lang.String value)
          Returns a String with special XML characters escaped as entities so that output XML is valid.
 
Methods inherited from class groovy.util.BuilderSupport
doInvokeMethod, getCurrent, invokeMethod, setClosureDelegate, setCurrent
 
Methods inherited from class groovy.lang.GroovyObjectSupport
getMetaClass, getProperty, setMetaClass, setProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

out

private IndentPrinter out

nospace

private boolean nospace

state

private int state

nodeIsEmpty

private boolean nodeIsEmpty
Constructor Detail

MarkupBuilder

public MarkupBuilder()

MarkupBuilder

public MarkupBuilder(java.io.PrintWriter writer)

MarkupBuilder

public MarkupBuilder(java.io.Writer writer)

MarkupBuilder

public MarkupBuilder(IndentPrinter out)
Method Detail

setParent

protected void setParent(java.lang.Object parent,
                         java.lang.Object child)
Specified by:
setParent in class BuilderSupport

createNode

protected java.lang.Object createNode(java.lang.Object name)
Specified by:
createNode in class BuilderSupport

createNode

protected java.lang.Object createNode(java.lang.Object name,
                                      java.lang.Object value)
Specified by:
createNode in class BuilderSupport

createNode

protected java.lang.Object createNode(java.lang.Object name,
                                      java.util.Map attributes,
                                      java.lang.Object value)
Specified by:
createNode in class BuilderSupport

createNode

protected java.lang.Object createNode(java.lang.Object name,
                                      java.util.Map attributes)
Specified by:
createNode in class BuilderSupport

nodeCompleted

protected void nodeCompleted(java.lang.Object parent,
                             java.lang.Object node)
Description copied from class: BuilderSupport
A hook to allow nodes to be processed once they have had all of their children applied

Overrides:
nodeCompleted in class BuilderSupport

print

protected void print(java.lang.Object node)

getName

protected java.lang.Object getName(java.lang.String methodName)
Description copied from class: BuilderSupport
A hook to allow names to be converted into some other object such as a QName in XML or ObjectName in JMX

Overrides:
getName in class BuilderSupport
Parameters:
methodName -
Returns:

transformName

protected java.lang.String transformName(java.lang.String name)

transformValue

protected java.lang.String transformValue(java.lang.String value)
Returns a String with special XML characters escaped as entities so that output XML is valid. Escapes the following characters as corresponding entities:

Parameters:
value - to be searched and replaced for XML special characters.
Returns:
value with XML characters escaped

toState

private void toState(int next,
                     java.lang.Object name)


Copyright © 2003-2005 The Codehaus. All Rights Reserved.