Skip to main content

Using %XML.TextReader 2

Next, the example program...

 If ($$$ISOK(sc)) {
     // ...
 }

...checks if the document was parsed correctly.

The ParseFile method returns a status code value (of type %StatusOpens in a new tab). If there are any problems with the document, or if the document could not be read, then this status code, sc in this case, will contain an error code.

This example uses the $$$ISOK macro to test if the status code is ok (does not contain an error). If we do encounter an error, we could display an error message by calling the DisplayError method of the $System.OBJ object:

 Do $system.OBJ.DisplayError(sc)

($System.OBJ refers to a special system object, %SYSTEM.OBJOpens in a new tab, whose methods provide a variety of services related to objects).

FeedbackOpens in a new tab