How do i use column characters in XPath of xmltype? [message #437443] |
Mon, 04 January 2010 07:32 |
Buchas
Messages: 101 Registered: March 2006
|
Senior Member |
|
|
Hello,
My problem is that I don't know how to use column characters (':') in XPath of xmltype.
For example:
select xmltype('<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="schema" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:transformResponse><transformReturn xsi:type="xsd:string">$$$lt;?xml version="1.0" encoding="utf-8"?$$$gt;$$$lt;policy registrator=""/$$$gt;</transformReturn></ns1:transformResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>').existsnode('/SOAP-ENV:Envelope/SOAP-ENV:Body/SOAP-ENV:Fault')from dual
Gives error: ORA-31013:Invalid XPath expression.
However if I simply replace all column caracters with something else:
select xmltype('<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV-Envelope xmlns-SOAP-ENV="http-//schemas.xmlsoap.org/soap/envelope/" xmlns-ns1="schema" xmlns-xsd="http-//www.w3.org/2001/XMLSchema" xmlns-xsi="http-//www.w3.org/2001/XMLSchema-instance" xmlns-SOAP-ENC="http-//schemas.xmlsoap.org/soap/encoding/" SOAP-ENV-encodingStyle="http-//schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV-Body><ns1-transformResponse><transformReturn xsi-type="xsd-string">$$$lt;?xml version="1.0" encoding="utf-8"?$$$gt;$$$lt;policy registrator=""/$$$gt;</transformReturn></ns1-transformResponse></SOAP-ENV-Body></SOAP-ENV-Envelope>').existsnode('/SOAP-ENV-Envelope/SOAP-ENV-Body')from dual
It returns 1, but simply replacing the string is not good, because there are other column caracters that are not needed to be replaced.
Help please! I would like it to work with column characters...
[Updated on: Mon, 04 January 2010 07:52] Report message to a moderator
|
|
|
|
Re: How do i use column characters in XPath of xmltype? [message #437450 is a reply to message #437445] |
Mon, 04 January 2010 08:09 |
Buchas
Messages: 101 Registered: March 2006
|
Senior Member |
|
|
OK, here is simplified example of a problem.
Does not work:
SELECT xmltype('<emp><empno>221</empno><en:ame>John</en:ame></emp>').existsnode('//en:ame') FROM dual
Gives error: ORA-31013:Invalid XPath expression.
Working one, without columns:
SELECT xmltype('<emp><empno>221</empno><ename>John</ename></emp>').existsnode('//ename') FROM dual
Why can't I use column characters in XML? As I understand, XML standard http://www.w3.org/TR/REC-xml/#charsets allows it.
|
|
|
|
|
|