Steven Shand wrote:

Hi,

I'm having some issues searching documents within a default namespace.

if my document looks like

<node1 xmlns="http://foo.bar.com"; >
    <bar>content</bar>
</node1>

I'd assume that I would do service.setNamespace( "",
"xmlns="http://foo.bar.com"; )

or even

service.setNamespace( null, "xmlns="http://foo.bar.com"; )

neither of these work.
However if I add a prefix to my document like:

<foo:node1 xmlns:foo="http://foo.bar.com"; >
    <foo:bar>content</foo:bar>
</foo:node1>

and do service.setNamespace( "foo", "xmlns="http://foo.bar.com"; )

my query works fine. Unfortunately this isn't a solution for me.

I came across something in the archives which seemed to say that as
long as I called setNamespace() with the location value, it didn't
really matter what was passed as a prefix. I've tried this and it
certainly doesn't work.

If anybody has some ideas on this I'd appreciate some feedback. It
seems like a very common use-case. I'm sure I must be missing
something.
I'm using the 1.1b4 build.


I tried
bin\xindice xpath -c /db/test -n ns -s a=http://foo.bar.com -q "/a:foo/a:bar"
with the document above and it did not work. Seems like a bug. If you find a solution to it, send a patch to the dev list. In either case, you can use bugzilla to track this issue.


Vadim




Reply via email to