Home » Developer & Programmer » JDeveloper, Java & XML » XMLTABLE with xmlnamespaces XPST0005 issue (Oracle Database 11.2.0.3 - Solaris)
XMLTABLE with xmlnamespaces XPST0005 issue [message #556483] Mon, 04 June 2012 11:42 Go to next message
zjw2112
Messages: 2
Registered: June 2012
Junior Member
Given the following XML:


<doc:document xmlns:doc="urn:su:abc:de:doc">
<titleList>
<title>
<value>Test</value>
</title>
</titleList>
</document>


and using the following query:


select X.*
from mytable,
XMLTABLE(xmlnamespaces('urn:su:abc:de:doc' as "doc"),
'$d/doc:document' passing docxml as "d"
COLUMNS
thetitle varchar2(50) PATH 'titleList/title/value') as X


I get the following error:

from mytable,
*

ERROR at line 2:

ORA-19276: XPST0005 - XPath step specifies an invalid element/attribute name: (doc:document doc='urn:su:abc:de:doc')


I don't understand why I get this error. Can anyone help? Thank you.
Re: XMLTABLE with xmlnamespaces XPST0005 issue [message #556484 is a reply to message #556483] Mon, 04 June 2012 11:56 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
Please read and follow the forum guidelines, to enable us to help you:

http://www.orafaq.com/forum/t/88153/0/
Re: XMLTABLE with xmlnamespaces XPST0005 issue [message #556485 is a reply to message #556484] Mon, 04 June 2012 12:27 Go to previous messageGo to next message
zjw2112
Messages: 2
Registered: June 2012
Junior Member
Without really knowing what I didn't abide by, I'll try again:

- I searched for XPST0005 in orafaq and no results returned, so I'm posting the question.
- Oracle DB Version: 11.2.0.3
- OS: Sun Sparc 5.10
- I cannot copy/paste the exact SQLPlus session, as it is on a stand-alone computer.

Given the following XML:

<doc:document xmlns:doc="urn:su:abc:de:doc">
<titleList>
<title>
<value>Test</value>
</title>
</titleList>
</document>


and I ran the following query and received an error:

select X.*
from mytable,
XMLTABLE(xmlnamespaces('urn:su:abc:de:doc' as "doc"),
'$d/doc:document' passing docxml as "d"
COLUMNS
thetitle varchar2(50) PATH 'titleList/title/value') as X


from mytable,
*

ERROR at line 2:

ORA-19276: XPST0005 - XPath step specifies an invalid element/attribute name: (doc:document doc='urn:su:abc:de:doc')




I don't understand why I get this error. Can anyone help? Thank you.
Re: XMLTABLE with xmlnamespaces XPST0005 issue [message #556491 is a reply to message #556485] Mon, 04 June 2012 14:15 Go to previous message
Barbara Boehmer
Messages: 9077
Registered: November 2002
Location: California, USA
Senior Member
Your inserted XML data is invalid. The following demonstrates that, then uses some slightly different data, followed by a slightly different query. This is an example of why we ask for a copy and paste. Please review what you have very carefully and make sure you have posted exactly the right XML data and exactly the right query.

SCOTT@orcl_11gR2> CREATE TABLE mytable (docxml XMLTYPE)
  2  /

Table created.

SCOTT@orcl_11gR2> INSERT INTO mytable VALUES
  2    (XMLTYPE
  3  	 ('<doc:document xmlns:doc="urn:su:abc:de:doc">
  4  	     <titleList>
  5  	       <title>
  6  		 <value>Test</value>
  7  	       </title>
  8  	     </titleList>
  9  	   </document>'))
 10  /
  (XMLTYPE
   *
ERROR at line 2:
ORA-31011: XML parsing failed
ORA-19202: Error occurred in XML processing
LPX-00225: end-element tag "document" does not match start-element tag
"doc:document"
Error at line 7
ORA-06512: at "SYS.XMLTYPE", line 310
ORA-06512: at line 1


SCOTT@orcl_11gR2> INSERT INTO mytable VALUES
  2    (XMLTYPE
  3  	 ('<document xmlns="urn:su:abc:de:doc">
  4  	     <titleList>
  5  	       <title>
  6  		 <value>Test</value>
  7  	       </title>
  8  	     </titleList>
  9  	   </document>'))
 10  /

1 row created.

SCOTT@orcl_11gR2> SELECT x.*
  2  FROM   mytable,
  3  	    XMLTABLE
  4  	      (XMLNAMESPACES ('urn:su:abc:de:doc' AS "doc"),
  5  	       '$d/doc:document' PASSING docxml AS "d"
  6  	       COLUMNS
  7  		 thetitle VARCHAR2(50) PATH 'doc:titleList/doc:title/doc:value') AS x
  8  /

THETITLE
--------------------------------------------------
Test

1 row selected.




Previous Topic: Load XML into DataBase multiple XSD Schema
Next Topic: PL/SQL XML Date Time omits Time part
Goto Forum:
  


Current Time: Fri Mar 29 03:50:08 CDT 2024