Groovy Documentation

groovy.xml
[Java] Class MarkupBuilderHelper

java.lang.Object
  groovy.xml.MarkupBuilderHelper

public class MarkupBuilderHelper
extends java.lang.Object

A helper class for MarkupBuilder.

Authors:
Paul King


Constructor Summary
MarkupBuilderHelper(MarkupBuilder builder)

@param builder the builder to delegate to

 
Method Summary
void comment(java.lang.String value)

Produce a comment in the output.

void pi(java.util.Map args)

Produce an XML processing instruction in the output.

void xmlDeclaration(java.util.Map args)

Produce an XML declaration in the output.

void yield(java.lang.Object value)

Prints data in the body of the current tag, escaping XML entities.

void yield(java.lang.String value)

Prints data in the body of the current tag, escaping XML entities.

void yieldUnescaped(java.lang.Object value)

Print data in the body of the current tag.

void yieldUnescaped(java.lang.String value)

Print data in the body of the current tag.

 
Methods inherited from class java.lang.Object
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()
 

Constructor Detail

MarkupBuilderHelper

public MarkupBuilderHelper(MarkupBuilder builder)
Parameters:
builder - the builder to delegate to


 
Method Detail

comment

public void comment(java.lang.String value)
Produce a comment in the output.

mkp.comment 'string' is equivalent to mkp.yieldUnescaped '<!-- string -->'. To create an element with the name 'comment', you need to supply empty attributes, e.g.:

 comment('hello1')
 
or
 mkp.comment('hello1')
 
will produce:
 <!-- hello1 -->
 
while:
 comment('hello2', [:])
 
will produce:
 <comment>hello2</comment>
 
Parameters:
value - the text within the comment.


pi

public void pi(java.util.Map args)
Produce an XML processing instruction in the output. For example:
 mkp.pi("xml-stylesheet":[href:"mystyle.css", type:"text/css"])
 
Parameters:
args - a map with a single entry whose key is the name of the processing instruction and whose value is the attributes for the processing instruction.


xmlDeclaration

public void xmlDeclaration(java.util.Map args)
Produce an XML declaration in the output. For example:
 mkp.xmlDeclaration(version:'1.0')
 
Parameters:
args - the attributes for the declaration


yield

public void yield(java.lang.Object value)
Prints data in the body of the current tag, escaping XML entities. For example: mkp.yield('5 < 7')
Parameters:
value - an Object whose toString() representation is to be printed


yield

public void yield(java.lang.String value)
Prints data in the body of the current tag, escaping XML entities. For example: mkp.yield('5 < 7')
Parameters:
value - text to print


yieldUnescaped

public void yieldUnescaped(java.lang.Object value)
Print data in the body of the current tag. Does not escape XML entities. For example: mkp.yieldUnescaped('I am <i>happy</i>!').
Parameters:
value - an Object whose toString() representation is to be printed


yieldUnescaped

public void yieldUnescaped(java.lang.String value)
Print data in the body of the current tag. Does not escape XML entities. For example: mkp.yieldUnescaped('I am <i>happy</i>!').
Parameters:
value - the text or markup to print.


 

Groovy Documentation