xml
Extract body of soap response
<?xml version="1.0" encoding="UTF-8"?> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Header> <si xmlns="http://tempuri.org">LOCALE=,USERID=</si> </soap:Header> <soap:Body> <ns2:data xmlns:ns2="http://service/"> <return> <id>10010</id> <approvementDate>16.06.2011 - 17:02:08</approvementDate> <currentYear>2010</currentYear> <resultCode>Success</resultCode> </return> </ns2:data> </soap:Body> </soap:Envelope> I need to extract the body node of the xml by using plsql ,below code works fine for Header extract('/soap:Envelope/soap:Header/child::node()','xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"'); but I could not get the body by this code extract('/soap:Envelope/soap:Header/soap:Body/child::node()','xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"'); Thank you for any help.
Body and Header are both direct descendant of the root node. You are trying to get a Body node under a Header node.There is no such child node of Header, so you get no result. The path should be: extract('/soap:Envelope/soap:Body/child::node()','xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"'); which as part of a PL/SQL block (with made-up table, column and variable names) would get: declare l_doc xmltype; l_body xmltype; begin select xml_col into l_doc from your_table; l_body := l_doc.extract('/soap:Envelope/soap:Body/child::node()', 'xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"'); dbms_output.put_line(l_body.getstringval); end; / PL/SQL procedure successfully completed. <ns2:data xmlns:ns2="http://service/"> <return> <id>10010</id> <approvementDate>16.06.2011 - 17:02:08</approvementDate> <currentYear>2010</currentYear> <resultCode>Success</resultCode> </return> </ns2:data>
Related Links
split a string based on a mapping - xslt
XML formatting Indentation Tags Matching - Linux
How to view xsl output in browsers?
Using a combination of databases/datasources in an application
How can I print large XML string generated by Oracle?
Change xml namespace in root element
SSIS transform rows to columns from xml
rearranging of XML elements and extracting relevant data from its values
XML Interpreter
XML UTF-8 encoding what is the correct way to represent the non-ascii data
XLINQ: string vs Convert.ToString() when extracting element values
Scala, combining filters on XML node
XML digital signature - wrongly computed digest
Zoho API inserRecord using Curl and XML, not returning an error and not adding the “Potential”
Magento - Move cart dropdown plugin to top.links. Reference name=“top.Links” not changing location
Read an include file using XSL