Using Xpath with Node Names with Colons (:)
509419Apr 13 2007 — edited Apr 17 2007Hi,
I'm attempting to retrieve the contents of "soapenv:Envelope" from the following xml:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/X
MLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header>
<responseTime soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0" xmlns="https://adwords.google.com/api/adwords/v8">86</responseTime>
<operations soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0" xmlns="https://adwords.google.com/api/adwords/v8">1</operations>
<units soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0" xmlns="https://adwords.google.com/api/adwords/v8">1</units>
<requestId soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0" xmlns="https://adwords.google.com/api/adwords/v8">d0bbb12ab9f3bd0523140b19767ef5dc</requestId>
</soapenv:Header>
</soapenv:Envelope>
I've tried using :
select extractValue(xml_data, '/soapenv:Envelope/@*') from XMLTable;
(assuming that xml_data is of type xmlType)
and receive the error:
ERROR at line 1:
ORA-31013: Invalid XPATH expression
However, if use the following:
select extract(xml_data, '//*[starts-with(name(),"soapenv:E")from XMLTable;
I get:
EXTRACT(XML_DATA,'//*[STARTS-WITH(NAME(),"SOAPENV:E")]')
--------------------------------------------------------------------------------
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmln
What gives...? How can I use the former query instead of the latter...?
Thanks...!
J