Hi Gio,
1. you can handle XML documents located within a Variable or even hardcode
the XML within the XMLTABLE.
2. In you document are namespaces used, you have to care about the
namespaces
3. You need to specify where you start in your XML document beginning from
the root element, i.e. S:Envelope/S:Body/S:Fault before you can get the
information you want.
The following example will return the faultstring value:
Select a.*
from XMLTABLE('/*:Envelope/*:Body/*:Fault'
passing xmlparse(Document '<S:Envelope
xmlns:S="
http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<S:Fault
xmlns:ns4="
http://www.w3.org/2003/05/soap-envelope">
<faultcode>S:Cli
ent</faultcode>
<faultstring>1:Invalid
username or password</faultstring>
</S:Fault>
</S:Body>
</S:Envelope>')
columns "faultstring" varchar(256) ) as a;
For more information please refer the following link:
Database SQL XML Programming
https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_73/rzasp/rzasppdf.pdf?
view=kc
Mit freundlichen Grüßen / Best regards
Birgitta Hauser
"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"
?Train people well enough so they can leave, treat them well enough so they
don't want to.? (Richard Branson)
-----Original Message-----
From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of
GioArt
Sent: Mittwoch, 31. Januar 2018 16:57
To: midrange-l@xxxxxxxxxxxx
Subject: Reading XML with SQL XMLTABLE
Hi all
I would try to read the following Xml with XMLTABLE function, but I don't
understand what I have to compose
the Sql statement
I tried :
Select a.* from XMLTABLE('Body' passing( xmlparse(Document
Get_xml_file('/tmp/txml.xml'))) columns faultstring
varchar(256) ) as a
This the xml content :
<?xml version="1.0" encoding="UTF-8"?>
<S:Envelope xmlns:S="
http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<S:Fault xmlns:ns4="
http://www.w3.org/2003/05/soap-envelope">
<faultcode>S:Cli ent</faultcode>
<faultstring>1:Invalid username or password</faultstring>
</S:Fault>
</S:Body>
</S:Envelope>
Can some help me to understand how do that ?
Other question : if have the xml file content in a variable .. can I use
SQL to parse Xml ?
Thanks in advance
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe,
or change list options,
visit:
https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at
https://archive.midrange.com/midrange-l.
Please contact support@xxxxxxxxxxxx for any subscription related questions.
Help support midrange.com by shopping at amazon.com with our affiliate link:
http://amzn.to/2dEadiD
As an Amazon Associate we earn from qualifying purchases.