The om.XmlWriter class implements methods to create a
om.SaxDocumentHandler
object, to be used to write XML to a stream.
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 thecharacters() method.
- Entity nodes are created with theom.SaxDocumentHandler.skippedEntityskippedEntity() 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.