[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Question to adopt enhancement to HTTP API - http_parser_switch_cb()
Hi Thomas,
I found your earlier message. However, please post anything like this
to the mailing list in the future -- it really belongs here on the
mailing list. (Though, do send me the attachments separately.)
I'm looking over your code, and fixing a few things. Some of the error
reporting isn't done properly, etc.. I'll fix that up.
Once I'm done I'll post a version in the "beta" section of my site for
people to test.
Thanks!
Thomas Raddatz wrote:
> 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
> -----------------------------------------------------------------------
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------