RXS_addHandler
From Wiki
|
| User Guide |
Contents |
Description
Call this subprocedure before RXS_parse to specify an event requiring notification. The event can be the beginning of an element, the content of an element, the end of an element or the attribute of an element.
Prototype
D RXS_addHandler pr D pXPath like(RXS_XPath) value D pHandler * procPtr value
Parameters
- pXPath
- The fully qualified path of the specified event.
- Example attribute Xpath: "/PostAdr/name@title" - note the "@" before title.
- Example element begin Xpath: "/PostAdr/name>" - note the ">" at the end.
- Example element content Xpath: "/PostAdr/name/first/" - note the "/" at the end.
- Example element end Xpath: “/PostAdr/name/>” – note the “/>” at the end.
- pHandler
- The address of the local subprocedure in your program for the parser to call when it encounters the Xpath. Use the %PADDR (Get Procedure Address) RPG BIF to obtain the address of the local subprocedure (i.e. %PADDR(myHandler)).
Return value
None.
Notes / Examples
Using RXS_addHandler for a specific event (i.e. /PostAdr/name@title) in a program will generate an event to the handler you specify. If you also specified RXS_allAttrHandler so your program were notified of all attributes, you would be better off removing the RXS_addHandler that was specific to /PostAdr/name@title as only one event will be generated and RXS_allAttrHandler would cover the /PostAdr/name@title event. It does not matter what the event type—RXS_ELEMBEGIN, RXS_ELEMCONTENT, RXS_ELEMEND—if the program registers an “all handler” for that event type, the parser will send the event to that handler.
