public class XMLOutputterWriter extends Object implements XMLOutputter
| Constructor and Description |
|---|
XMLOutputterWriter(Writer w)
Constructs an XML outputter from a writer.
|
XMLOutputterWriter(Writer w,
boolean withXMLDeclaration)
Constructs an XML outputter from a writer.
|
XMLOutputterWriter(Writer w,
boolean withXMLDeclaration,
String encoding)
Constructs an XML outputter from a writer.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addAttribute(String name,
String value)
Adds an attribute of type string to the current XML tag.
|
void |
addBigIntegerAttribute(String name,
BigInteger value)
Adds an attribute of type big integer to the current XML tag.
|
void |
addBooleanAttribute(String name,
boolean value)
Adds an attribute of type boolean to the current XML tag.
|
void |
addCharacterData(Reader readerData)
Adds character data for the current XML tag.
|
void |
addCharacterData(String data)
Adds character data for the current XML tag.
|
void |
addComment(String... lines)
Adds a comment.
|
void |
addDateAttribute(String name,
Date value)
Adds an attribute of type date to the current XML tag;
Dates are encoded using ISO 8601 format, that is:
'YYYY-MM-DD'.
|
void |
addDateTimeAttribute(String name,
Date value)
Adds an attribute of type date and time to the current XML tag;
Date and times are encoded using ISO 8601 format, that is:
'YYYY-MM-DDTHH:MM:SS.mmm'.
|
void |
addDecimalAttribute(String name,
BigDecimal value)
Adds an attribute of type decimal to the current XML tag.
|
void |
addIntegerAttribute(String name,
Integer value)
Adds an attribute of type integer to the current XML tag.
|
void |
addLongAttribute(String name,
Long value)
Adds an attribute of type long to the current XML tag.
|
void |
addText(String data,
boolean asCData)
Adds text for the current XML element.
|
void |
endTag(String tag)
Ends the XML tag.
|
void |
marshal(String tagName,
IXMLMarshallable child)
Marshals a node into this writer.
|
void |
setIndent(boolean indent)
Sets to
false if the result cannot be indented, otherwise sets to true. |
void |
setIndentLevel(int indentLevel)
Sets the indent level of the XML writer.
|
void |
startTag(String tag)
Starts a XML tag.
|
public XMLOutputterWriter(Writer w)
w - The writer to write XML inpublic XMLOutputterWriter(Writer w, boolean withXMLDeclaration)
w - The writer to write XML inwithXMLDeclaration - Specifies if the XML header must be writtenpublic void setIndent(boolean indent)
false if the result cannot be indented, otherwise sets to true.indent - Sets to false if the result cannot be indented otherwise sets to truepublic void setIndentLevel(int indentLevel)
indentLevel - the indent level of the XML writerpublic void marshal(String tagName, IXMLMarshallable child)
XMLOutputterThe sequence is:
IXMLMarshallable.marshalAttributes(XMLOutputter)IXMLMarshallable.marshalChildren(XMLOutputter)
Note
This method is taking care of handling a null child.
marshal in interface XMLOutputtertagName - The name of child XML tagchild - The child itself, that must be marshalledpublic void startTag(String tag)
XMLOutputterstartTag in interface XMLOutputtertag - The name of the XML tag to start withpublic void addAttribute(String name, String value)
XMLOutputteraddAttribute in interface XMLOutputtername - The name of the attributevalue - The text value of the attributepublic void addDecimalAttribute(String name, BigDecimal value)
XMLOutputteraddDecimalAttribute in interface XMLOutputtername - The name of the attributevalue - The numerical value of the attributepublic void addDateTimeAttribute(String name, Date value)
XMLOutputteraddDateTimeAttribute in interface XMLOutputtername - The name of the attributevalue - The value of the attributepublic void addDateAttribute(String name, Date value)
XMLOutputteraddDateAttribute in interface XMLOutputtername - The name of the attributevalue - The date value of the attributepublic void addBooleanAttribute(String name, boolean value)
XMLOutputteraddBooleanAttribute in interface XMLOutputtername - The name of the attributevalue - The value of the attributepublic void addCharacterData(String data)
XMLOutputteraddCharacterData in interface XMLOutputterdata - The character data to add for the current tagpublic void addCharacterData(Reader readerData)
XMLOutputteraddCharacterData in interface XMLOutputterreaderData - The character data to add for the current tag as a Readerpublic void addText(String data, boolean asCData)
data - The text to add for the current XML elementasCData - Specifies if the text must be marked as character data (CDATA)public void addComment(String... lines)
lines - The line(s) of the comment to addpublic void endTag(String tag)
XMLOutputterendTag in interface XMLOutputtertag - The name of the XML tag to closepublic void addIntegerAttribute(String name, Integer value)
XMLOutputteraddIntegerAttribute in interface XMLOutputtername - The name of the attributevalue - The integer value of the attributepublic void addLongAttribute(String name, Long value)
XMLOutputteraddLongAttribute in interface XMLOutputtername - The name of the attributevalue - The value of the attributepublic void addBigIntegerAttribute(String name, BigInteger value)
XMLOutputteraddBigIntegerAttribute in interface XMLOutputtername - The name of the attributevalue - The value of the attribute