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.

Note: Using this approach saves coding time when a program will retrieve a majority of the end element events.

Example values for the pXPath parameter:

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

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_allAttrHandler() 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.

Subprocedure Prototype

D RXS_addHandler  pr

Enables parsing of a specific event.

D  pXPath                             like(RXS_XPath) value

The fully qualified path of the specified event.

Example: /PostAdr/name@title (attribute XPath)

Example: /PostAdr/name> (element begin XPath)

Example: /PostAdr/name/first/ (content XPath)

Example: /PostAdr/name/> (element end XPath)

D  pHandler                       *   procPtr value

The address of the local subprocedure in your program that should be called when it encounters the XPath. This subprocedure must have the prototype as shown in the example event handler. Use the %PADDR Built-In Function to obtain the address of the local subprocedure (e.g. %Paddr(myHandler)).