Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

XPath Namespace resolver problem

843834Dec 16 2009 — edited Jan 13 2010
I've trying to run a simple XPath query
//z:row
in Java against against the following XML.
<?xml version="1.0" encoding="utf-8"?>
<test xmlns:rs="urn:schemas-microsoft-com:rowset"
     xmlns:z="#RowsetSchema">
<rs:data>
  <z:row>XX</z:row>
</rs:data>
</test>
I've written my own namespace prefix resolver, and also used the NamespaceContext object at the end of this example [http://www.ibm.com/developerworks/xml/library/x-nmspccontext/index.html?ca=drs-|http://www.ibm.com/developerworks/xml/library/x-nmspccontext/index.html?ca=drs-]

The problem is that I also get the following error:
javax.xml.transform.TransformerException:A location step was expected following the '/' or '//' token.

The problem is the *#* sign in the xmlns:z="#RowsetSchema". If I rename the namespace to be just xmlns:z="RowsetSchema" then it works fine.

Help, this is driving me mad.

TIA
Ian
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 10 2010
Added on Dec 16 2009
3 comments
3,488 views