[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: LIBHTTP and namespace support



Hi Loek,

Actually, I already have a copy of HTTPXMLR4 that does namespace 
processing (I haven't made it available to the public, it's just on my 
own machine.)

The way I did it:

    a)  I created an exported procedure named http_xmlns().  It
        only lets you set a flag to indicate that you want namespace
        enabled or disabled.

    b)  I changed the InitParser() routine to look for the flag, and
        if found, it'll call XML_CreateParserNS instead of
        XML_CreateParser().  It always uses x'0c' for the separator.

    c)  I changed StartElement() to check the flag... if it's set,
        if separarates the namespace from the element name and stores
        them in separate fields of the elemroot structure.

    d) I changed both StartElement() and endElement() to use a different
        prototype for the callback, so if the flag is turned on, it
        calls a callback with a separate namespace parameter.  If not,
        it uses the original callback prototype.

This way, I can use http_xmlns() to enable namespace support for all of
the routines in HTTPAPI that parse xml (http_url_get_xml, 
http_url_post_xml, http_url_post_stmf_xml, http_url_get_xmltf, 
http_url_post_xmltf, http_url_post_stmf_xmltf, and http_parse_xml_stmf)

Call me lazy, but I didn't want to create a separate prototype for each
of those routines!  I also didn't want to have to manually specify the
separator character and write code to parse it in every callback.

If you're interested, I can add this namespace code to the beta version 
for 1.18 and upload it to my web site.  Would you like to try it?


l.maartens wrote:
>    Hi Scott,
> 
> 
> 
>    I have modified my copy of the HTTPAPI to include namespace support.
>    You had it already included in Expat, so adding it in the HTTAPI was
>    not to difficult. For now I have chosen to make a copy of the
>    http_parse_xml_stmf procedure to http_parse_xmlns_stmf in HTTPXMLR4. I
>    have added an additional parameter peXmlNS, which can be optional. If
>    passed it passes that charater on to the parser, else it uses the
>    default HTTP_XML_SEPCHAR value (which I have set to x'0c' as per your
>    namespace article in iSeriesNews).
> 
> 
> 
>    I have left the incoming prototypess etc as they were, although
>    that gives the programmer the burden to interogate the path value out
>    of the incoming procedure in the following way:
> 
>    when (path =
>         '/' + xmlns_soapenv + Sepchar + 'Envelope'
>        +'/' + xmlns_soapenv + Sepchar + 'Body'
>        +'/' + xmlns_soapenv + Sepchar + 'Fault'
>        +'/' + xmlns_soapenv + Sepchar + 'Code'
>        +'/' + xmlns_soapenv + Sepchar + 'Subcode');
> 
> 
> 
>    The value xmlns_soapenv is a named constant containing the value :
> 
> 
> 
>    D xmlns_soapenv   C
>    'http://schemas.xmlsoap.org/soap/env-
>    D
>    elope/'
> 
> 
> 
>    The value sepchar is defined as:
> 
>    D Sepchar         S              1A   inz(HTTP_XML_SEPCHAR)
> 
> 
> 
>    If this can be improved upon I would like to hear from you, otherwise
>    when I have finished adding the namespaced versions of the xml parsing
>    procedures, I will send the modifications to you if you like them well
>    enough to include them in the HTTPAPI.
> 
> 
> 
> 
> 
>    Kind regards,
> 
> 
> 
>    Loek Maartens,
> 
>    Veracity Software Consultancy BV
> 
> 
> 
> ------------------------------------------------------------------------
> 
> -----------------------------------------------------------------------
> 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
-----------------------------------------------------------------------