You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Shah Asrani <sh...@gmail.com> on 2008/12/09 18:56:52 UTC
xpath question
If I have a DOM tree available, is it possible to return the xpath
string required for selected node.
Shah Asrani
---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org
Re: xpath question
Posted by Dave Brosius <db...@apache.org>.
While there are an infinite number of xpaths that represent any arbitrary
node, one can be built by walking up the tree, at each level appending
nodename[x] where x is the index of the child among it's same-named
siblings.
----- Original Message -----
From: "Shah Asrani" <sh...@gmail.com>
To: <j-...@xerces.apache.org>
Sent: Tuesday, December 09, 2008 12:56 PM
Subject: xpath question
> If I have a DOM tree available, is it possible to return the xpath
> string required for selected node.
>
> Shah Asrani
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org
Re: xpath question
Posted by Shah Asrani <sh...@gmail.com>.
Thanks for the guidance. I tried walking though the built DOM tree
and I can now create xpath expressions.
Shah Asrani
On Tue, Dec 9, 2008 at 1:37 PM, Michael Glavassevich
<mr...@ca.ibm.com> wrote:
> There's no method in the API that returns an XPath, if that's what you're
> asking. You would need to construct it yourself by walking the tree. Should
> be fairly simple.
>
> Michael Glavassevich
> XML Parser Development
> IBM Toronto Lab
> E-mail: mrglavas@ca.ibm.com
> E-mail: mrglavas@apache.org
>
> "Shah Asrani" <sh...@gmail.com> wrote on 12/09/2008 12:56:52 PM:
>
>
>> If I have a DOM tree available, is it possible to return the xpath
>> string required for selected node.
>>
>> Shah Asrani
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
>> For additional commands, e-mail: j-users-help@xerces.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org
Re: xpath question
Posted by Michael Glavassevich <mr...@ca.ibm.com>.
There's no method in the API that returns an XPath, if that's what you're
asking. You would need to construct it yourself by walking the tree. Should
be fairly simple.
Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org
"Shah Asrani" <sh...@gmail.com> wrote on 12/09/2008 12:56:52 PM:
> If I have a DOM tree available, is it possible to return the xpath
> string required for selected node.
>
> Shah Asrani
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org