Home » Developer & Programmer » JDeveloper, Java & XML » How do i use column characters in XPath of xmltype? (Oracle9i Enterprise Edition Release 9.2.0.4.0)
How do i use column characters in XPath of xmltype? [message #437443] Mon, 04 January 2010 07:32 Go to next message
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 #437445 is a reply to message #437443] Mon, 04 January 2010 08:01 Go to previous messageGo to next message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Line of code larger than 80 characters are hard to read, without speaking about your lines larger than 1000 characters.

Regards
Michel
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 Go to previous messageGo to next message
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.
Re: How do i use column characters in XPath of xmltype? [message #437453 is a reply to message #437443] Mon, 04 January 2010 08:13 Go to previous messageGo to next message
ramoradba
Messages: 2456
Registered: January 2009
Location: AndhraPradesh,Hyderabad,I...
Senior Member
Hope This will help you(Please read the total content

sriram Smile
Re: How do i use column characters in XPath of xmltype? [message #437588 is a reply to message #437453] Tue, 05 January 2010 03:01 Go to previous messageGo to next message
Buchas
Messages: 101
Registered: March 2006
Senior Member
Thanks for the link, it really helped!
Re: How do i use column characters in XPath of xmltype? [message #437589 is a reply to message #437588] Tue, 05 January 2010 03:05 Go to previous message
ramoradba
Messages: 2456
Registered: January 2009
Location: AndhraPradesh,Hyderabad,I...
Senior Member
First of all /forum/fa/6103/0/

And next time Please/forum/fa/456/0/ before posting.

Goodluck /forum/fa/2877/0/

sriram Smile
Previous Topic: how to write a Persian string in Jtextfield
Next Topic: [Urgent]Error when using dbms_java.loadjava
Goto Forum:
  


Current Time: Thu Mar 28 07:48:36 CDT 2024