mark, carsten and dawid,

thanks a ton guys, for your answers.

i am StringTokenizing and parsing the xpathquery result. finally! only now i
am positive that what i knew is correct :-)

-nani

-----Original Message-----
From: Mark J. Stang [mailto:[EMAIL PROTECTED]
Sent: Thursday, April 25, 2002 11:35 PM
To: [email protected]
Subject: Re: XPath details [Repeat Posting]


nani,
The result of an XPathQueryResult is a document.   You have to parse that
resulting document to get your result.   The result will contain the key
that
matches your XPath Query.   If you search on an attribute, you will get back
the element that contains that attribute.  Therefore, a search on
//*/[EMAIL PROTECTED]
will return an XML document that contains the <ccc value="Hello"></ccc> the
collection it came from and the key to the document that contains the
element.

You will have to parse the document to get the key and the "attributes">.
Since the format is the same, this can be done fairly easily with a SAX
parser.
I know of no other way, nature of the beast...

HTH,

Mark

Jayaram Narayana wrote:

> =============================================================
> this question has been posted to the xindice dev. forum also.
> =============================================================
>
> hi there,
>
> using an xpath query returns a lot more information than what's actually
> required. example, given an element that looks like this:
>
> <aaa>
>         <bbb>
>         <ccc value = "Hello">
> </aaa>
>
> and an xpath query like this:
> "//ccc [EMAIL PROTECTED]"
>
> will return a big result like this:
>
> <aaa xmlns:src="http://xml.apache.org/xindice/Query"; src:col="/db/zzz/yyy"
> src:key="eee">
>  <ccc value="Hello" />
> </aaa>
>
> all i am interested in is the value of the attribute "value" (Hello). how
> can i get JUST that directly, and nothig else? i do not want to parse the
> DOM for this.
>
> TIA,
> -nani


Reply via email to