public class XMLOutputterWriter extends java.lang.Object implements XMLOutputter
| Constructor and Description |
|---|
XMLOutputterWriter(java.io.Writer w)
Constructs an XML outputter from a writer.
|
XMLOutputterWriter(java.io.Writer w,
boolean withXMLDeclaration)
Constructs an XML outputter from a writer.
|
XMLOutputterWriter(java.io.Writer w,
boolean withXMLDeclaration,
java.lang.String encoding)
Constructs an XML outputter from a writer.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addAttribute(java.lang.String name,
java.lang.String value)
Adds an attribute of type string to the current XML tag.
|
void |
addBigIntegerAttribute(java.lang.String name,
java.math.BigInteger value)
Adds an attribute of type big integer to the current XML tag.
|
void |
addBooleanAttribute(java.lang.String name,
boolean value)
Adds an attribute of type boolean to the current XML tag.
|
void |
addCharacterData(java.io.Reader readerData)
Adds character data for the current XML tag.
|
void |
addCharacterData(java.lang.String data)
Adds character data for the current XML tag.
|
void |
addComment(java.lang.String... lines)
Adds a comment.
|
void |
addDateAttribute(java.lang.String name,
java.util.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(java.lang.String name,
java.util.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(java.lang.String name,
java.math.BigDecimal value)
Adds an attribute of type decimal to the current XML tag.
|
void |
addEscapedCharacterData(java.lang.String data) |
void |
addIntegerAttribute(java.lang.String name,
java.lang.Integer value)
Adds an attribute of type integer to the current XML tag.
|
void |
addLongAttribute(java.lang.String name,
java.lang.Long value)
Adds an attribute of type long to the current XML tag.
|
void |
addText(java.lang.String data,
boolean asCData)
Adds text for the current XML element.
|
void |
endTag(java.lang.String tag)
Ends the XML tag.
|
void |
marshal(java.lang.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(java.lang.String tag)
Starts a XML tag.
|
public XMLOutputterWriter(java.io.Writer w)
w - The writer to write XML inpublic XMLOutputterWriter(java.io.Writer w,
boolean withXMLDeclaration)
w - The writer to write XML inwithXMLDeclaration - Specifies if the XML header must be writtenpublic XMLOutputterWriter(java.io.Writer w,
boolean withXMLDeclaration,
java.lang.String encoding)
w - The writer to write XML inwithXMLDeclaration - Specifies if the XML header must be writtenencoding - The encoding to set in the XML headerpublic 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(java.lang.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(java.lang.String tag)
XMLOutputterstartTag in interface XMLOutputtertag - The name of the XML tag to start withpublic void addAttribute(java.lang.String name,
java.lang.String value)
XMLOutputteraddAttribute in interface XMLOutputtername - The name of the attributevalue - The text value of the attributepublic void addDecimalAttribute(java.lang.String name,
java.math.BigDecimal value)
XMLOutputteraddDecimalAttribute in interface XMLOutputtername - The name of the attributevalue - The numerical value of the attributepublic void addDateTimeAttribute(java.lang.String name,
java.util.Date value)
XMLOutputteraddDateTimeAttribute in interface XMLOutputtername - The name of the attributevalue - The value of the attributepublic void addDateAttribute(java.lang.String name,
java.util.Date value)
XMLOutputteraddDateAttribute in interface XMLOutputtername - The name of the attributevalue - The date value of the attributepublic void addBooleanAttribute(java.lang.String name,
boolean value)
XMLOutputteraddBooleanAttribute in interface XMLOutputtername - The name of the attributevalue - The value of the attributepublic void addCharacterData(java.lang.String data)
XMLOutputteraddCharacterData in interface XMLOutputterdata - The character data to add for the current tagpublic void addCharacterData(java.io.Reader readerData)
XMLOutputteraddCharacterData in interface XMLOutputterreaderData - The character data to add for the current tag as a Readerpublic void addEscapedCharacterData(java.lang.String data)
public void addText(java.lang.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(java.lang.String... lines)
lines - The line(s) of the comment to addpublic void endTag(java.lang.String tag)
XMLOutputterendTag in interface XMLOutputtertag - The name of the XML tag to closepublic void addIntegerAttribute(java.lang.String name,
java.lang.Integer value)
XMLOutputteraddIntegerAttribute in interface XMLOutputtername - The name of the attributevalue - The integer value of the attributepublic void addLongAttribute(java.lang.String name,
java.lang.Long value)
XMLOutputteraddLongAttribute in interface XMLOutputtername - The name of the attributevalue - The value of the attributepublic void addBigIntegerAttribute(java.lang.String name,
java.math.BigInteger value)
XMLOutputteraddBigIntegerAttribute in interface XMLOutputtername - The name of the attributevalue - The value of the attribute