Write an XML document
- Last Updated: June 7, 2019
- 1 minute read
- OpenEdge
- Version 13.0
- Documentation
The program flow of an XML write follows this general pattern in a forward-only stream:
- The write begins with the
START-DOCUMENTmethod and the document prolog is written. - To build an element, use the
START-ELEMENTmethod to create the start tag for the desired element type. If you have created a SAX-attributes either to programatically build a list of attributes for the element or to capture a set of attributes during a SAX read operation, you can pass it as an optional parameter to theSTART-ELEMENTmethod. (TheWRITE-EMPTY-ELEMENTandWRITE-DATA-ELEMENTmethods also can take a SAX-attributes object as an optional parameter.) - Use the following methods to build the content of the tag:
INSERT-ATTRIBUTE( )methodDECLARE-NAMESPACE( )methodWRITE-CDATA( )methodWRITE-CHARACTERS( )methodWRITE-ENTITY-REF( )methodWRITE-FRAGMENT( )method
- Use the
END-ELEMENTmethod to provide the closing tag for the named element. - Use the other methods to provide other types of XML content:
WRITE-EMPTY-ELEMENT( )methodWRITE-DATA-ELEMENT( )methodWRITE-EXTERNAL-DTD( )methodWRITE-PROCESSING-INSTRUCTION( )methodWRITE-COMMENT( )method
- Use the
END-DOCUMENTmethod to close the XML document.