CXML-OPEN-FILE

Opens the named file with an XML parser, positioning it at the top-level element.

Syntax:

CALL "C$XML" USING CXML-OPEN-FILE, filename

Parameters:

CXML-OPEN-FILE Op-code 10. Numeric data item that specifies the operation to perform. Each operation is defined in acucobol.def, which is included with your system.
filename pic x(n) or alphanumeric literal

On Entry:

CXML-OPEN-FILE Value 10
filename The name of the file to open with the parser.

On Exit:

RETURN-CODE A parser handle

Comments:

To simply open a file, but not parse it, use the CXML-OPEN-FILE op-code. With the file open, you can then parse individual records using the CXML-PARSE-NEXT-RECORD op-code. To open and read an entire XML file, use the CXML-PARSE-FILE op-code.

C$XML can parse local or remote files — even files located on the Internet. You simply specify the server, IP address, or URL in the pathname. You cannot write to URLs, however.

Example:

CALL "C$XML" using CXML-OPEN-FILE "http://www.nws.noaa.gov/data/current_obs/KMYF.xml" 
move return-code to parser-handle 
CALL "C$XML" using CXML-PARSE-NEXT-RECORD parser-handle 
move return-code to record-handle