[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Question to adopt enhancement to HTTP API - http_parser_switch_cb()
Hi Scott,
I already tried to contact you by e-mail but since I did not get any reply I assume that I used an old
e-mail address.
I want to ask you to adopt the enhancement that I developed for HTTP API V1.21. Nowadays you specify a
start and an end element callback procedure for e.g. http_post_xml(). With the enhancement you can
change the (start/end element) callback procedures for a given sub-tree of the XML stream. You do that
by calling http_parser_switch_cb() from within a start element callback procedure. From that point on
the parser calls the new callback procedures. The old onces are pushed on a stack. When the parser
reaches the corresponding end element the previous callback procedures are restored.
Changing the callback procedures is particular useful if the same sub-trees appears at different
locations (levels) in the XML stream. For example think of a <message> element that contains an <ID>
and a <TEXT> element. That <message> element may appear at different levels of the XML stream.
Wouldn't it be nice to use the same code to get the message information from the XML stream regardless
of where the <message> element appears? With http_parser_switch_cb() you can change the callback
procedures and the user data when the parser hits a <message> element. Now the specialized message
callback procedures can get the message information out of the XML stream and put it into that portion
of the user data that is supposed to take the message information. Level and path information is
adjusted accordingly.
Description:
rc = http_parser_switch_cb(peUsrDta: peStartProc: peEndProc)
peUsrDta = (input) user-defined data that will be passed to
the call-back routine. usually only that
portion of the current user data is forwarded
to the new callback procedures that they are
responsible for.
peStartProc = (input) call-back procedure to call at the start
of each XML element received.
peEndProc = (input) call-back procedure to call at the end
of each XML element received.
Returns -1 upon failure, 0 upon success
I want to utilize that enhancement to write a WSDL2RPG generator to produce an RPG Web Service stub
for a given Web Service operation. So far I generate a specialized set of callback procedures for each
complex element of the XML stream. Whenever the parser hits a complex element it delegates element
processing to the specialized procedures.
I can send to you patch files and an example program if you want to have a closer look at it.
Regards,
Thomas Raddatz.
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------