Well, if JXPath gives you an XPointer from an XPath, why not just generate
an XPath for a node? It will obviously not be the most readable XPath, or
the most efficient (doing that is impossible). For example if you
have:

<foo>
 <bar1>
   <bar2/>
   <bar3/>
 </bar1>
</foo>

and you want an XPath for bar3, it could simply be:

child::*[position()=1]/child::*[position()=1]/child::*[position()=2]

run against the Document node.

You should be able to accomplish this with about 10 lines of code.

hth,
-Nikhil


On Thu, 30 Mar 2006, Brian Demers wrote:

> JXPath can return an XPointer string from a given XPath expression.
> How ever this is not all that usefull to me.
>
> Does anyone know of a way to automaticly generate and XPointer string
> from a given XML node?
>
> Thanks again!
>
> On 3/30/06, Michael Glavassevich <[EMAIL PROTECTED]> wrote:
> > On Mon, 27 Mar 2006, Brian Demers wrote:
> >
> > > Can an XPointer string be generated from a given node?  How about when
> > > using XInclude and DOM parsing?
> > >
> > > What about SAX parsing?
> >
> > If you're looking for an API which does this, I don't know of one.
> >
> > > Thanks again!
> > > -Brian Demers
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> > ---------------------------
> > Michael Glavassevich
> > XML Parser Development
> > IBM Toronto Lab
> > E-mail: [EMAIL PROTECTED]
> > E-mail: [EMAIL PROTECTED]
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to