[EMAIL PROTECTED] wrote:
David,
thanks for your answer. The sample code and text documents are at work.
What I can remember until now is that I stepped into the xPath
evaluation function and set breakpoint for the namespace resolution.
Somehow the default resolver used by Xalan always delivered null for the
prefix. But my root element definitely has some specified namespaces.
A possible sample document could be the following:
<root xmlns="http://my_unique_url_1" xmlns:tcs="http://my_unique_url_1"
xmlns:cf="http://my_unique_url_2" xmlns:gen="http://my_unique_url_3"
xmlns:xsi="schema-default-instance-which-I-currently-do-not-remember"
xmlns:schemaLocation="http://my_unique_url_1 ./schema1.xsd etc..."
att1="some text" att2="some text2">
<sub1 tcs:name="state1">
<cf:sub11 tcs:id="123"/>
<cf:sub11 tcs:id="1234"/>
</sub1>
</root>
xPath expression is:
/tcs:root/tcs:sub1/cf:[EMAIL PROTECTED]:id='123']
This is fine with your sample. But if I parse it with a non-validating
Xerces-C 2.7.0 parser and pass the DOM as described below I receive
NULL-Pointer.
If it works with the sample application, but not with the Xerces-C DOM
you build, then you should verify you are building a namespace-aware
DOM. Insert a call to setDoNamespaces(true) on the parsrer instance,
before you call the parse() member function.
Dave