Class XMLWriter

java.lang.Object
com.amazonaws.util.XMLWriter

public class XMLWriter extends Object
Utility for creating easily creating XML documents, one element at a time.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new XMLWriter, ready to write an XML document to the specified writer.
    XMLWriter(Writer w, String xmlns)
    Creates a new XMLWriter, ready to write an XML document to the specified writer.
  • Method Summary

    Modifier and Type
    Method
    Description
    Closes the last opened element at the current position in the in-progress XML document.
    Starts a new element with the specified name at the current position in the in-progress XML document.
    Adds the string representation of the specified object to the current position of the in progress XML document.
    Adds the specified value as text to the current position of the in progress XML document.
    Adds the specified value as Base64 encoded text to the current position of the in progress XML document.
    value(Date date)
    Adds the specified date as text to the current position of the in-progress XML document.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • XMLWriter

      public XMLWriter(Writer w)
      Creates a new XMLWriter, ready to write an XML document to the specified writer. The XML document will not specify an xmlns attribute.
      Parameters:
      w - The writer this XMLWriter will write to.
    • XMLWriter

      public XMLWriter(Writer w, String xmlns)
      Creates a new XMLWriter, ready to write an XML document to the specified writer. The root element in the XML document will specify an xmlns attribute with the specified namespace parameter.
      Parameters:
      w - The writer this XMLWriter will write to.
      xmlns - The XML namespace to include in the xmlns attribute of the root element.
  • Method Details

    • startElement

      public XMLWriter startElement(String element)
      Starts a new element with the specified name at the current position in the in-progress XML document.
      Parameters:
      element - The name of the new element.
      Returns:
      This XMLWriter so that additional method calls can be chained together.
    • endElement

      public XMLWriter endElement()
      Closes the last opened element at the current position in the in-progress XML document.
      Returns:
      This XMLWriter so that additional method calls can be chained together.
    • value

      public XMLWriter value(String s)
      Adds the specified value as text to the current position of the in progress XML document.
      Parameters:
      s - The text to add to the XML document.
      Returns:
      This XMLWriter so that additional method calls can be chained together.
    • value

      public XMLWriter value(ByteBuffer b)
      Adds the specified value as Base64 encoded text to the current position of the in progress XML document.
      Parameters:
      b - The binary data to add to the XML document.
      Returns:
      This XMLWriter so that additional method calls can be chained together.
    • value

      public XMLWriter value(Date date)
      Adds the specified date as text to the current position of the in-progress XML document.
      Parameters:
      date - The date to add to the XML document.
      Returns:
      This XMLWriter so that additional method calls can be chained together.
    • value

      public XMLWriter value(Object obj)
      Adds the string representation of the specified object to the current position of the in progress XML document.
      Parameters:
      obj - The object to translate to a string and add to the XML document.
      Returns:
      This XMLWriter so that additional method calls can be chained together.