You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xindice-users@xml.apache.org by "R. Mark Volkmann" <ma...@ociweb.com> on 2004/12/30 00:52:48 UTC

xpath queries

When I run the xpath query "/*" on a collection, it returns all the documents in
the collection.  The name of their root elements is "service".  When I run the
query "/service" I get nothing back.  How can this be?

--
R. Mark Volkmann
Partner, Object Computing, Inc.

Re: xpath queries

Posted by "R. Mark Volkmann" <ma...@ociweb.com>.
Quoting "R. Mark Volkmann" <ma...@ociweb.com>:

> Quoting "R. Mark Volkmann" <ma...@ociweb.com>:
>
> > When I run the xpath query "/*" on a collection, it returns all the
> documents
> > in
> > the collection.  The name of their root elements is "service".  When I run
> > the
> > query "/service" I get nothing back.  How can this be?
>
> Here's more detail.
>
> This query returns nothing.
> "/service[@name='Weather']/description"
>
> This query returns the description element.
> "/*[@name='Weather']/*[name()='description']"
>
> It seems that I can't directly use the name of an element in the xpath.
> I think this is a namespace problem.
> What do I have to do to declare the namespace of the elements in my xpath?

Solved!  I have to use -s to specify the namespace.
Here's a working query.

xindice xpath -c %XDB%/services
-q "/p:service[@name='Weather']/p:description"
-s "p=http://www.boeing.com/fcs/service"

--
R. Mark Volkmann
Partner, Object Computing, Inc.

Re: xpath queries

Posted by "R. Mark Volkmann" <ma...@ociweb.com>.
Quoting "R. Mark Volkmann" <ma...@ociweb.com>:

> When I run the xpath query "/*" on a collection, it returns all the documents
> in
> the collection.  The name of their root elements is "service".  When I run
> the
> query "/service" I get nothing back.  How can this be?

Here's more detail.

This query returns nothing.
"/service[@name='Weather']/description"

This query returns the description element.
"/*[@name='Weather']/*[name()='description']"

It seems that I can't directly use the name of an element in the xpath.
I think this is a namespace problem.
What do I have to do to declare the namespace of the elements in my xpath?

--
R. Mark Volkmann
Partner, Object Computing, Inc.

XPath query results in DOM form?

Posted by "R. Mark Volkmann" <ma...@ociweb.com>.
Is there a way to get query results in DOM form instead of as a string?

--
R. Mark Volkmann
Partner, Object Computing, Inc.