Package com.highdeal.hci
Class XMLOutputterWriter
java.lang.Object
com.highdeal.hci.XMLOutputterWriter
- All Implemented Interfaces:
XMLOutputter
Implementation of an XMLOutputter using a writer.
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs 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. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAttribute(String name, String value) Adds an attribute of type string to the current XML tag.voidaddBigIntegerAttribute(String name, BigInteger value) Adds an attribute of type big integer to the current XML tag.voidaddBooleanAttribute(String name, boolean value) Adds an attribute of type boolean to the current XML tag.voidaddCharacterData(Reader readerData) Adds character data for the current XML tag.voidaddCharacterData(String data) Adds character data for the current XML tag.voidaddComment(String... lines) Adds a comment.voidaddDateAttribute(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'.voidaddDateTimeAttribute(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'.voidaddDecimalAttribute(String name, BigDecimal value) Adds an attribute of type decimal to the current XML tag.voidvoidaddIntegerAttribute(String name, Integer value) Adds an attribute of type integer to the current XML tag.voidaddLongAttribute(String name, Long value) Adds an attribute of type long to the current XML tag.voidAdds text for the current XML element.voidEnds the XML tag.voidmarshal(String tagName, IXMLMarshallable child) Marshals a node into this writer.voidsetIndent(boolean indent) Sets tofalseif the result cannot be indented, otherwise sets totrue.voidsetIndentLevel(int indentLevel) Sets the indent level of the XML writer.voidStarts a XML tag.
-
Constructor Details
-
XMLOutputterWriter
Constructs an XML outputter from a writer.- Parameters:
w- The writer to write XML in
-
XMLOutputterWriter
Constructs an XML outputter from a writer.- Parameters:
w- The writer to write XML inwithXMLDeclaration- Specifies if the XML header must be written
-
XMLOutputterWriter
Constructs an XML outputter from a writer.- Parameters:
w- The writer to write XML inwithXMLDeclaration- Specifies if the XML header must be writtenencoding- The encoding to set in the XML header
-
-
Method Details
-
setIndent
public void setIndent(boolean indent) Sets tofalseif the result cannot be indented, otherwise sets totrue.- Parameters:
indent- Sets to false if the result cannot be indented otherwise sets to true
-
setIndentLevel
public void setIndentLevel(int indentLevel) Sets the indent level of the XML writer.- Parameters:
indentLevel- the indent level of the XML writer
-
marshal
Description copied from interface:XMLOutputterMarshals a node into this writer.The sequence is:
- Writing the start XML tag
- Writing the attributes
IXMLMarshallable.marshalAttributes(XMLOutputter) - Calling recursively
IXMLMarshallable.marshalChildren(XMLOutputter) - Writing the end XML tag
Note
This method is taking care of handling a
nullchild.- Specified by:
marshalin interfaceXMLOutputter- Parameters:
tagName- The name of child XML tagchild- The child itself, that must be marshalled
-
startTag
Description copied from interface:XMLOutputterStarts a XML tag.- Specified by:
startTagin interfaceXMLOutputter- Parameters:
tag- The name of the XML tag to start with
-
addAttribute
Description copied from interface:XMLOutputterAdds an attribute of type string to the current XML tag.- Specified by:
addAttributein interfaceXMLOutputter- Parameters:
name- The name of the attributevalue- The text value of the attribute
-
addDecimalAttribute
Description copied from interface:XMLOutputterAdds an attribute of type decimal to the current XML tag.- Specified by:
addDecimalAttributein interfaceXMLOutputter- Parameters:
name- The name of the attributevalue- The numerical value of the attribute
-
addDateTimeAttribute
Description copied from interface:XMLOutputterAdds 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'.- Specified by:
addDateTimeAttributein interfaceXMLOutputter- Parameters:
name- The name of the attributevalue- The value of the attribute
-
addDateAttribute
Description copied from interface:XMLOutputterAdds an attribute of type date to the current XML tag; Dates are encoded using ISO 8601 format, that is: 'YYYY-MM-DD'.- Specified by:
addDateAttributein interfaceXMLOutputter- Parameters:
name- The name of the attributevalue- The date value of the attribute
-
addBooleanAttribute
Description copied from interface:XMLOutputterAdds an attribute of type boolean to the current XML tag.- Specified by:
addBooleanAttributein interfaceXMLOutputter- Parameters:
name- The name of the attributevalue- The value of the attribute
-
addCharacterData
Description copied from interface:XMLOutputterAdds character data for the current XML tag.- Specified by:
addCharacterDatain interfaceXMLOutputter- Parameters:
data- The character data to add for the current tag
-
addCharacterData
Description copied from interface:XMLOutputterAdds character data for the current XML tag.- Specified by:
addCharacterDatain interfaceXMLOutputter- Parameters:
readerData- The character data to add for the current tag as aReader
-
addEscapedCharacterData
-
addText
Adds text for the current XML element.- Parameters:
data- The text to add for the current XML elementasCData- Specifies if the text must be marked as character data (CDATA)
-
addComment
Adds a comment.- Parameters:
lines- The line(s) of the comment to add
-
endTag
Description copied from interface:XMLOutputterEnds the XML tag.- Specified by:
endTagin interfaceXMLOutputter- Parameters:
tag- The name of the XML tag to close
-
addIntegerAttribute
Description copied from interface:XMLOutputterAdds an attribute of type integer to the current XML tag.- Specified by:
addIntegerAttributein interfaceXMLOutputter- Parameters:
name- The name of the attributevalue- The integer value of the attribute
-
addLongAttribute
Description copied from interface:XMLOutputterAdds an attribute of type long to the current XML tag.- Specified by:
addLongAttributein interfaceXMLOutputter- Parameters:
name- The name of the attributevalue- The value of the attribute
-
addBigIntegerAttribute
Description copied from interface:XMLOutputterAdds an attribute of type big integer to the current XML tag.- Specified by:
addBigIntegerAttributein interfaceXMLOutputter- Parameters:
name- The name of the attributevalue- The value of the attribute
-