Skip to main content

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:

  1. Reads an XML document from a specified file (in this case, filename),

  2. parses and validates the document,

  3. constructs a document structure, and,

  4. 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.

FeedbackOpens in a new tab