The XmlWriter class

The om.XmlWriter class implements methods to write XML to a stream.

The om.XmlWriter class implements methods to create a om.SaxDocumentHandler object.

Steps to use a XML writer:
  1. Declare a variable with the om.SaxDocumentHandler type.
  2. Create the writer object with one of the class methods of om.XmlWriter and assign the reference to the variable.
  3. Output XML data with the methods of the om.SaxDocumentHandler object:
    1. Use the method startDocument() to start writing to the output.
    2. From this point, the order of method calls defines the structure of the XML document. To write an element, fill an om.SaxAttributes object with attributes.
    3. Then, initiate the element output with the method startElement().
    4. Write element data with the characters() method.
    5. Entity nodes are created with the skippedEntity() method.
    6. Finish element output with a call to the endElement() method.
    7. Repeat these steps as many times as you have elements to write.
    8. Instead of using the startElement() method, you can generate processing instruction elements with processingInstruction().
    9. Finally, you must finish the document output with a endDocument() call.