public class MarkupBuilderHelper extends Object
Constructor and Description |
---|
MarkupBuilderHelper(MarkupBuilder builder) |
Modifier and Type | Method and Description |
---|---|
void |
comment(String value)
Produce a comment in the output.
|
void |
pi(Map<String,Map<String,Object>> args)
Produce an XML processing instruction in the output.
|
void |
xmlDeclaration(Map<String,Object> args)
Produce an XML declaration in the output.
|
void |
yield(Object value)
Prints data in the body of the current tag, escaping XML entities.
|
void |
yield(String value)
Prints data in the body of the current tag, escaping XML entities.
|
void |
yieldUnescaped(Object value)
Print data in the body of the current tag.
|
void |
yieldUnescaped(String value)
Print data in the body of the current tag.
|
public MarkupBuilderHelper(MarkupBuilder builder)
builder
- the builder to delegate topublic void yield(Object value)
mkp.yield('5 < 7')
value
- an Object whose toString() representation is to be printedpublic void yield(String value)
mkp.yield('5 < 7')
value
- text to printpublic void yieldUnescaped(Object value)
mkp.yieldUnescaped('I am <i>happy</i>!')
.value
- an Object whose toString() representation is to be printedpublic void yieldUnescaped(String value)
mkp.yieldUnescaped('I am <i>happy</i>!')
.value
- the text or markup to print.public void comment(String value)
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>
value
- the text within the comment.public void xmlDeclaration(Map<String,Object> args)
mkp.xmlDeclaration(version:'1.0')
args
- the attributes for the declarationpublic void pi(Map<String,Map<String,Object>> args)
mkp.pi("xml-stylesheet":[href:"mystyle.css", type:"text/css"])
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.