com.highdeal.hci
Class XMLOutputterWriter

java.lang.Object
  extended by com.highdeal.hci.XMLOutputterWriter
All Implemented Interfaces:
XMLOutputter

public class XMLOutputterWriter
extends java.lang.Object
implements XMLOutputter

Implementation of an XMLOutputter using a writer.


Constructor Summary
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.
 
Method Summary
 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.lang.String data)
          Adds character data for the current XML tag.
 void addComment(java.lang.String... lines)
           
 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 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 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 startTag(java.lang.String tag)
          Starts a XML tag.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLOutputterWriter

public XMLOutputterWriter(java.io.Writer w)
Constructs an XML outputter from a writer.

Parameters:
w - The writer to write XML in

XMLOutputterWriter

public XMLOutputterWriter(java.io.Writer w,
                          boolean withXMLDeclaration)
Constructs an XML outputter from a writer.

Parameters:
w - The writer to write XML in
withXMLDeclaration - Specifies if the XML header must be written

XMLOutputterWriter

public XMLOutputterWriter(java.io.Writer w,
                          boolean withXMLDeclaration,
                          java.lang.String encoding)
Constructs an XML outputter from a writer.

Parameters:
w - The writer to write XML in
withXMLDeclaration - Specifies if the XML header must be written
encoding - The encoding to set in the XML header
Method Detail

setIndent

public void setIndent(boolean indent)
Sets to false if the result cannot be indented, otherwise sets to true.

Parameters:
indent - Sets to false if the result cannot be indented otherwise sets to true

marshal

public void marshal(java.lang.String tagName,
                    IXMLMarshallable child)
Description copied from interface: XMLOutputter
Marshals a node into this writer.

The sequence is:

  1. Writing the start XML tag
  2. Writing the attributes IXMLMarshallable.marshalAttributes(XMLOutputter)
  3. Calling recursively IXMLMarshallable.marshalChildren(XMLOutputter)
  4. Writing the end XML tag

Note

This method is taking care of handling a null child.

Specified by:
marshal in interface XMLOutputter
Parameters:
tagName - The name of child XML tag
child - The child itself, that must be marshalled

startTag

public void startTag(java.lang.String tag)
Description copied from interface: XMLOutputter
Starts a XML tag.

Specified by:
startTag in interface XMLOutputter
Parameters:
tag - The name of the XML tag to start with

addAttribute

public void addAttribute(java.lang.String name,
                         java.lang.String value)
Description copied from interface: XMLOutputter
Adds an attribute of type string to the current XML tag.

Specified by:
addAttribute in interface XMLOutputter
Parameters:
name - The name of the attribute
value - The text value of the attribute

addDecimalAttribute

public void addDecimalAttribute(java.lang.String name,
                                java.math.BigDecimal value)
Description copied from interface: XMLOutputter
Adds an attribute of type decimal to the current XML tag.

Specified by:
addDecimalAttribute in interface XMLOutputter
Parameters:
name - The name of the attribute
value - The numerical value of the attribute

addDateTimeAttribute

public void addDateTimeAttribute(java.lang.String name,
                                 java.util.Date value)
Description copied from interface: XMLOutputter
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'.

Specified by:
addDateTimeAttribute in interface XMLOutputter
Parameters:
name - The name of the attribute
value - The value of the attribute

addDateAttribute

public void addDateAttribute(java.lang.String name,
                             java.util.Date value)
Description copied from interface: XMLOutputter
Adds an attribute of type date to the current XML tag; Dates are encoded using ISO 8601 format, that is: 'YYYY-MM-DD'.

Specified by:
addDateAttribute in interface XMLOutputter
Parameters:
name - The name of the attribute
value - The date value of the attribute

addBooleanAttribute

public void addBooleanAttribute(java.lang.String name,
                                boolean value)
Description copied from interface: XMLOutputter
Adds an attribute of type boolean to the current XML tag.

Specified by:
addBooleanAttribute in interface XMLOutputter
Parameters:
name - The name of the attribute
value - The value of the attribute

addCharacterData

public void addCharacterData(java.lang.String data)
Description copied from interface: XMLOutputter
Adds character data for the current XML tag.

Specified by:
addCharacterData in interface XMLOutputter
Parameters:
data - The character data to add for the current tag

addComment

public void addComment(java.lang.String... lines)

endTag

public void endTag(java.lang.String tag)
Description copied from interface: XMLOutputter
Ends the XML tag.

Specified by:
endTag in interface XMLOutputter
Parameters:
tag - The name of the XML tag to close

addIntegerAttribute

public void addIntegerAttribute(java.lang.String name,
                                java.lang.Integer value)
Description copied from interface: XMLOutputter
Adds an attribute of type integer to the current XML tag.

Specified by:
addIntegerAttribute in interface XMLOutputter
Parameters:
name - The name of the attribute
value - The integer value of the attribute

addLongAttribute

public void addLongAttribute(java.lang.String name,
                             java.lang.Long value)
Description copied from interface: XMLOutputter
Adds an attribute of type long to the current XML tag.

Specified by:
addLongAttribute in interface XMLOutputter
Parameters:
name - The name of the attribute
value - The value of the attribute

addBigIntegerAttribute

public void addBigIntegerAttribute(java.lang.String name,
                                   java.math.BigInteger value)
Description copied from interface: XMLOutputter
Adds an attribute of type big integer to the current XML tag.

Specified by:
addBigIntegerAttribute in interface XMLOutputter
Parameters:
name - The name of the attribute
value - The value of the attribute

Document Published: October 2015 (SAP CC 4.0 SP10 and Later)