Using %XML.TextReader
The first part of the example program...
// Create an instance of %XML.TextReader (returned by reference)
Set sc = ##class(%XML.TextReader).ParseFile(filename,.reader)
...calls the ParseFile method. This is a class method of the %XML.TextReaderOpens in a new tab class that:
-
Reads an XML document from a specified file (in this case, filename),
-
parses and validates the document,
-
constructs a document structure, and,
-
creates an instance of %XML.TextReaderOpens in a new tab class and returns it by reference (using the variable, reader, in this case).
Note that %XML.TextReaderOpens in a new tab provides the additional methods, ParseStream, ParseString, and ParseURL, for reading a document from a stream object, a local string, or a URL, respectively.