Guys,
I have a very basic Question on namespace prefixes when using an xpath
expression.
I have a document,
<foo:A xmlns:foo="urn:foo.org">
<B>123</B>
<C>456</C>
<D>789</D>
</foo:A>
If an xpath = "foo:A/foo:C" is applied it doesn't return anything and
obviously it works for "//*/C". Does every element under A should come
with a namespace prefix "foo:"
If the xml is structured as
<A xmlns="urn:foo.org">
<B xmlns:foo="urn:foo.org">123</B>
<C xmlns:foo="urn:foo.org">456</C>
<D xmlns:foo="urn:foo.org">789</D>
</foo:A>
The xpath = "//*/myfoo:C" [myfoo is the prefix I wish to use while
doing the xpath which is passed on through a namespace prefix resolver]
Both are well-formed xml though.
I am using JDK1.5 XPath API and a custom JAXP1.3 NameSpaceContext
implementation.
Tools like xmlspy give varied results which I guess they are trying to
be liberal.
Could some one explain what is wrong in the way the prefixes are
declared?
Thanks
Shankar