Try OpenEdge Now
skip to main content
Working with XML
Reading and Writing XML with the Document Object Model (DOM) : Reading XML input into ABL : Loading an XML file
 

Loading an XML file

The LOAD( ) method reads the specified file into memory, parses it, optionally validates it, and makes its contents available to ABL. Once the XML file is in memory, you must get the handle to its root element by using the GET-DOCUMENT-ELEMENT( ) method. Once you have the root node handle, you can manipulate the remaining child nodes.
The following code fragment demonstrates loading an XML file called myfile.xml:
DEFINE VARIABLE hDocMine  AS HANDLE NO-UNDO.
DEFINE VARIABLE hRootMine AS HANDLE NO-UNDO.

CREATE X-DOCUMENT hDocMine.
CREATE X-NODEREF hRootMine.

hDocMine:LOAD("FILE","myfile.xml",TRUE).
hDocMine:GET-DOCUMENT-ELEMENT(hRootMine).
. . .
* Loading an XML file from a LONGCHAR
* Loading an XML file from a MEMPTR