Debugging an XML-SAX Handling Procedure

The second parameter passed to an XML-SAX event handling procedure is a numeric value indicating which SAX event was discovered by the parser.

In your RPG code, you can test the event value using special values like *XML_START_ELEMENT and *XML_DOCTYPE_DECL.

However, these special values are not available in the debugger. Instead, you can use a special array that is made available if you code the DEBUG(*XMLSAX) keyword in your Control specification. The name of the array is _QRNU_XMLSAX; the values of the array elements are the same as the names of the special words, minus the leading "*XML_".

For example, if the name of the second parameter of your XML-SAX event handling procedure is "xmlEvent", then use the following debugger expression to determine the name of the event:

EVAL _QRNU_XMLSAX(xmlEvent)

Result: _QRNU_XMLSAX(XMLEVENT) = 'START_DOCUMENT      '

The third parameter passed to the event handler is a pointer to the data. See Displaying Data Addressed by Pointers, using the value of the fourth parameter to determine the length of the data, in bytes.

For an Exception event, the fifth parameter holds the error code related to the parsing exception. See Processing XML Documents for the meanings of the error codes.



[ Top of Page | Previous Page | Next Page | Contents | Index ]