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:
- Declare a variable with the om.SaxDocumentHandler type.
- Create the writer object with one of the class methods of om.XmlWriter
and assign the reference to the variable.
- Output XML data with the methods of the om.SaxDocumentHandler object:
- Use the method startDocument() to start writing to the output.
- 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.
- Then, initiate the element output with the method startElement().
- Write element data with the characters() method.
- Entity nodes are created with the skippedEntity() method.
- Finish element output with a call to the endElement() method.
- Repeat these steps as many times as you have elements to write.
- Instead of using the startElement() method, you can generate
processing instruction elements with processingInstruction().
- Finally, you must finish the document output with a endDocument() call.