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

RE: http_parse_xml_string usage



Scott,

Thank you very much for the quick reply and detailed explanation,
especially regarding the pointer parameter. Makes perfect sense. 

I have a (WebSmart) RPG CGI web application that retrievs data from an
HTTP Post request into a variable. The data retrieved is a string of
XML. I planned to use http_parse_xml_string to parse the xml directly
but, if I understand you, http_parse_xml_string will not work for me
because my xml is in EBCDIC.

I guess that leaves me with moving the data to a temporary IFS file and
parsing it with http_parse_xml_stmf(). 

Sincerely,
--rmc


-----Original Message-----
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
[mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Scott
Klement
Sent: Wednesday, October 29, 2008 8:35 PM
To: HTTPAPI and FTPAPI Projects
Subject: Re: http_parse_xml_string usage

Hi Rick,

> XMLData = '<OrderID>123</OrderID>';
> 
> rc = http_parse_xml_string(%addr(XMLData) : %len(XMLData)
>    : HTTP_XML_CALC : %paddr(BegTag) : %paddr(EndTag) : *null);

HTTP_XML_CALC is not supported with http_parse_xml_string().  Note the
docs for http_parse_xml_Stmf() list HTTP_XML_CALC as a valid value, but
the docs for http_parse_xml_string() do not.

Even if I did support HTTP_XML_CALC (and, again, I do not) it makes
little sense in your example.  In your example, the data is in EBCDIC,
but the processing directive <?xml encoding=xxx ?> doesn't exist, so the
parser should (per XML standards) fall back on ISO-8859-1 which is a
flavor of ASCII.  So even if I decided to support HTTP_XML_CALC, your
code would still not work.


> I receive XML parse failed at line 1, col 0: not well-formed (invalid
> token).

That's because the EBCDIC value for < is not a valid start for an XML
document.  (It has to be ASCII or Unicode).

-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------