|
|||||
FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
A helper class for creating XML or HTML markup
Field Summary | |
---|---|
boolean |
nodeIsEmpty
|
boolean |
nospace
|
boolean |
omitEmptyAttributes
|
boolean |
omitNullAttributes
|
IndentPrinter |
out
|
int |
state
|
boolean |
useDoubleQuotes
|
Constructor Summary | |
MarkupBuilder()
|
|
MarkupBuilder(PrintWriter writer)
|
|
MarkupBuilder(Writer writer)
|
|
MarkupBuilder(IndentPrinter out)
|
Method Summary | |
---|---|
Object |
createNode(Object name)
|
Object |
createNode(Object name, Object value)
|
Object |
createNode(Object name, Map attributes, Object value)
|
Object |
createNode(Object name, Map attributes)
|
String |
escapeAttributeValue(String value)
Escapes a string so that it can be used directly as an XML attribute value. |
String |
escapeElementContent(String value)
Escapes a string so that it can be used directly in XML element content. |
String |
escapeXmlValue(String value, boolean isAttrValue)
Escapes a string so that it can be used in XML text successfully. |
boolean |
getDoubleQuotes()
Returns true if attribute values are output with
double quotes; false if single quotes are used.
|
Object |
getMkp()
|
Object |
getName(String methodName)
|
IndentPrinter |
getPrinter()
|
boolean |
isOmitEmptyAttributes()
Determine whether empty attributes will appear in the produced markup. |
boolean |
isOmitNullAttributes()
Determine whether null attributes will appear in the produced markup. |
void |
nodeCompleted(Object parent, Object node)
|
void |
print(Object node)
|
void |
setDoubleQuotes(boolean useDoubleQuotes)
Sets whether the builder outputs attribute values in double quotes or single quotes. |
void |
setOmitEmptyAttributes(boolean omitEmptyAttributes)
Allows empty attributes to be removed the produced markup. |
void |
setOmitNullAttributes(boolean omitNullAttributes)
Allows null attributes to be removed the produced markup. |
void |
setParent(Object parent, Object child)
|
void |
toState(int next, Object name)
|
String |
transformValue(String value)
Returns a String with special XML characters escaped as entities so that output XML is valid. |
void |
yield(String value)
|
void |
yieldUnescaped(String value)
|
Constructor Detail |
---|
public MarkupBuilder()
public MarkupBuilder(PrintWriter writer)
public MarkupBuilder(Writer writer)
public MarkupBuilder(IndentPrinter out)
Method Detail |
---|
Object createNode(Object name)
Object createNode(Object name, Object value)
Object createNode(Object name, Map attributes, Object value)
Object createNode(Object name, Map attributes)
String escapeAttributeValue(String value)
String escapeElementContent(String value)
String escapeXmlValue(String value, boolean isAttrValue)
true
if the string is to be usedfalse
.
public boolean getDoubleQuotes()
true
if attribute values are output with
double quotes; false
if single quotes are used.
By default, single quotes are used.
public Object getMkp()
Object getName(String methodName)
IndentPrinter getPrinter()
public boolean isOmitEmptyAttributes()
true
, if empty attributes will be
public boolean isOmitNullAttributes()
true
, if null attributes will be
void nodeCompleted(Object parent, Object node)
void print(Object node)
public void setDoubleQuotes(boolean useDoubleQuotes)
true
,
public void setOmitEmptyAttributes(boolean omitEmptyAttributes)
true
, emptyfalse
.
public void setOmitNullAttributes(boolean omitNullAttributes)
true
, nullfalse
null attributes will be included in the
markup as empty strings regardless of the omitEmptyAttribute
setting. Defaults to false
.
void setParent(Object parent, Object child)
void toState(int next, Object name)
String transformValue(String value)
public void yield(String value)
public void yieldUnescaped(String value)