Try OpenEdge Now
skip to main content
Working with XML
Reading and Writing XML with the Document Object Model (DOM) : Internationalization


XML documents may be encoded using any of a wide a variety of character encoding. The DOM parser returns character data to ABL interpreter encoded, if possible, according to -cpinternal, the Internal Code Page parameter. This translation is performed by the DOM parser using its own translation functions. If the DOM parser cannot perform the translation according to -cpinternal, it translates to UTF8 which is then translated by the interpreter from UNICODE to the character encoding specified by -cpinternal. The encoding used in an XML document is specified by an optional encoding declaration at its very beginning. If the encoding declaration is present, it specifies the encoding used in the remainder of the document. If the declaration is not present, the document's encoding is assumed to be UTF-8 or UTF-16.
When the LOAD method is used to load an XML document, the ENCODING attribute of the X-document object will be set to the name of encoding found in the encoding declaration of the document. For output, you can set the X-document object's ENCODING attribute to the name of the desired encoding.
When the SAVE method is used to write an output XML document from a memory-resident DOM tree, the generated XML text is encoded by the DOM parser according to the value of the ENCODING attribute. When you SAVE a document to a stream, the specified encoding is used and the value of -cpstream is ignored.
According to the XML recommendation, "it is a fatal error when an XML processor encounters an entity with an encoding that it is unable to process." If this error occurs while ABL is attempting to load a document, the document will be empty.