[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE : I would like to parse CDATA !
Hello,
I don't want to abuse, but I have another problem.
Some of XML tags I have to parse looks like this :
<dept type="icao">ORY</dept>
When I parse my document, neither StartProc nor EndProc called by http_parse_xml_stmf can trap an event returning "type" as name and "icao" as value.
How can I do that ?
Best regards
Alain RUAS
Technical Manager
(33) 562 747 500
-----Message d'origine-----
De : Scott Klement [mailto:sk@xxxxxxxxxxxxxxxx]
Envoyé : mar. 23 septembre 2008 10:43
À : HTTPAPI and FTPAPI Projects
Objet : Re: I would like to parse CDATA !
Hello,
The web service is sending you data where the XML tags have been escaped
so that there's no chance of a conflict between the XML tags in the
response and the tags in the SOAP envelope. This is very common.
The solution is very simple. Just have your end-tag-handler (often
called "Incoming", though you can call it anything you choose) save it
to a temporary IFS file. Then, parse that IFS file.
Here are some examples of doing that (these are old examples, I haven't
tried them recently to see if the web services are still offered -- but
either way, I hope the RPG code illustrates what you need to do.)
http://www.scottklement.com/httpapi/bankrout.txt
http://www.scottklement.com/httpapi/vattest-rpgle.txt
As for the 
 stuff -- I'm hoping that these are normal XML entities
that will be fixed by doing the 2nd XML parse, as described above. If
they are not, consider using RPG's %scan & %replace functions to scan
for them and remove them from the document. Since others don't seem to
have problems with this, I don't think it makes sense to make it part of
HTTPAPI.
Alain RUAS wrote:
> Hi,
>
>
> I'm consuming a web service with HTTPAPI.
>
>
> The web service response is a quite long XML flow like this :
>
>
> <?xml version="1.0" ?>
>
> <S:Envelope
> xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><S:Body><construct
> ionOutput xmlns="http://drc99.euronautical.com/">
>
> <?xml version="1.0" encoding="ISO-8859-1"
> ?>
>
> <drcresp version="1.0" reqid="tstaru">
>
> <constructed>
>
> <inp>
>
> <dept type="icao">ORY</dept>
>
> <dest type="icao">TLS</dest>
>
> etc ..
>
>
> If I replace < ; " ; etc .. by the right signs, the result is :
>
> <?xml version="1.0" ?>
>
> <S:Envelope
> xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><S:Body><construct
> ionOutput xmlns="http://drc99.euronautical.com/">
>
> <?xml version= `'1.0'' encoding=''ISO-8859-1'' ?>
>
> <drcresp version=''1.0'' reqid=''tstaru''>
>
> <constructed>
>
> <inp>
>
> <dept type=''icao''>ORY</dept>
>
> <dest type=`'icao''>TLS</dest>
>
> etc ..
>
>
> All the text constructed as CDATA is, in fact, true XML.
>
>
> Is there a solution to force the API to parse it ?
>
>
> May I have help ?
>
>
> In addition, is it possible to make "http_XmlStripCRLF(*ON/*OFF)"
>
> able to manage 
>
>
> Best regards
>
>
> Alain RUAS
>
> Technical Manager
>
> (33) 562 747 500
>
>
>
> ------------------------------------------------------------------------
>
> -----------------------------------------------------------------------
> 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
-----------------------------------------------------------------------
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------