The event-handling procedure is a user-written prototyped procedure. It must have the following return type and parameters:
Parameter number or return value | Data type and passing mode | Description |
---|---|---|
Return value | 4-byte integer (10I 0) | Returning a value of zero indicates that parsing should continue; returning any other value indictes that parsing should end. |
1 - Communication area | Any type, passed by reference | Used to communicate between the XML-SAX operation and the handler, and between successive calls to the handler. |
2 - Event | 4-byte integer (10I 0), passed by value | The XML event discovered by the parser. Special words such as *XML_START_ELEMENT can be used to identify the events within the handling procedure. See XML events. |
3 - Data | Pointer (*), passed by value | If this parameter is not relevant to the event, it will have a value of *NULL. Otherwise, it will point to the data for the event. For the *XML_UCS2_REF, and *XML_ATTR_UCS2_REF events, the data will always be UCS-2 data. For all other events, the data will be in the CCSID specified by the "ccsid" option of the %XML built-in function. |
4 - Length | 8-byte integer (20I 0), passed by value | For most events, this is the length of the data pointed to by the third parameter, in bytes. If this parameter is not relevant for a particular event, it will have the value -1. If the data is being returned in UCS-2 due to the "ccsid" option of the %XML built-in function, this value must be divided by two to obtain the number of UCS-2 characters.
For the *XML_EXCEPTION event, this parameter will have the length of the document that was parsed when the error occurred. |
5 - Exception ID | 4-byte integer (10I 0), passed by value | The exception ID. For all events other than *XML_EXCEPTION, this parameter will have a value of zero. See the section on XML return codes in the IBM Rational Development Studio for i: ILE RPG Programmer's Guide. |
See %HANDLER (handlingProcedure : communicationArea ) for more information on %HANDLER.
D saxHandler pr 10i 0
D commArea likeds(myCommArea)
D event 10i 0 value
D string * value
D stringlen 20i 0 value
D exceptionId 10i 0 value