SAX-writer overview
- Last Updated: March 30, 2020
- 1 minute read
- OpenEdge
- Version 12.2
- Documentation
SAX-writer overview
The SAX-writer is an ABL object created with the CREATE
SAX-WRITER statement and accessed through a SAX-writer
object handle. A collection of attributes and methods on the handle
allow you to configure options and stream the XML content element
by element to a variety of output destinations.
Writing XML with a SAX-writer object is an alternative to outputting the DOM document tree of an X-document object. The DOM document tree needs to be completely built and stored in memory before you can output it. In contrast, the SAX-writer object only needs enough memory to handle the largest single element in your XML output. The streaming nature of the SAX-writer object makes it a better choice for writing large XML documents.
The following table summarizes the attributes and methods of the SAX-writer object.
| Attribute or Method | Description |
ENCODING attribute |
Returns the name of the character encoding used
to encode the contents of an XML document (for example, UTF-8, UTF-16, ASCII,
and so on). The values must match the standard IANA encoding values. |
FORMATTED attribute |
Determines whether the XML output has extra formatting to make it a human-readable document. |
FRAGMENT attribute |
Specifies if the output of a SAX-writer object is a complete document or a fragment. |
STANDALONE attribute |
Determines the value of the standalone attribute in the XML declaration. |
STRICT attribute |
Determines if the SAX-writer object should ensure that the XML document is well formed XML. |
VERSION attribute |
Determines the value of the version string in the XML declaration. |
WRITE-STATUS attribute |
The current state of an XML write in a SAX-writer object. Certain method calls are only valid with certain status values. |
DECLARE-NAMESPACE( ) method |
Adds a namespace declaration to an XML element. |
END-DOCUMENT( ) method |
Closes the XML document. |
END-ELEMENT( ) method |
Ends an XML element based upon the specified element name. |
INSERT-ATTRIBUTE( ) method |
Adds a single attribute to a start tag in an XML element. |
RESET( ) method |
Closes the open stream and resets the SAX-writer object to its default values. |
SET-OUTPUT-DESTINATION( ) method |
Defines the target of the XML document that the SAX-writer object creates. |
START-DOCUMENT( ) method |
Creates the XML document with the prolog information. |
START-ELEMENT( ) method |
Starts an XML element based upon the specified name. |
WRITE-CDATA( ) method |
Adds a CDATA block to an XML
element. |
WRITE-CHARACTERS( ) method |
Adds character data to an XML element. |
WRITE-COMMENT( ) method |
Adds a comment to the XML document. |
WRITE-DATA-ELEMENT( ) method |
Adds a complete XML element. |
WRITE-EMPTY-ELEMENT( ) method |
Creates an empty XML element. |
WRITE-EXTERNAL-DTD( ) method |
Adds an external Document Type Definition (DTD) reference to an XML document. |
WRITE-ENTITY-REF( ) method |
Adds an entity reference to the XML stream. |
WRITE-FRAGMENT( ) method |
Adds character data to the XML element. |
WRITE-PROCESSING-INSTRUCTION( ) method |
Creates a processing instruction node in an XML document. |