Re: [xml-dev] Simple xpath software request
by Daniel Veillard other posts by this author
Feb 28 2002 4:47PM messages near this date
Re: [xml-dev] Simple xpath software request
|
Re: [xml-dev] Simple xpath software request
On Thu, Feb 28, 2002 at 12:58:41PM -0700, Kris Thompson wrote:
> I must have missed it but I feel like my searching has been complete. I
> am looking for a way, using one of the more popular parsers idealy
> Xerces, to if given a node in a document return the XPath string
> representation of that node. Something like the following would be nice
>
> public static String getXPath(Document doc, Node node)
>
> where node is the node that I want the XPath expression on and doc
> is the document for which this node exist.
>
> If this does not exist in any popular parsers than has anyone created
> this piece of code for which I could have?
Available as:
xmlChar * xmlGetNodePath(xmlNodePtr node);
in libxml2 (http://xmlsoft.org/)
http://xmlsoft.org/html/libxml-tree.html#XMLGETNODEPATH
Note of course that there isn't "the" XPath string to select that node
there is an infinity of those. 2 implementation could return different
path and both be right.
Daniel
--
Daniel Veillard | Red Hat Network https://rhn.redhat.com/
veillard@[...].com | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
-----------------------------------------------------------------
The xml-dev list is sponsored by XML.org <http://www.xml.org> , an
initiative of OASIS <http://www.oasis-open.org>
The list archives are at http://lists.xml.org/archives/xml-dev/
To subscribe or unsubscribe from this list use the subscription
manager: <http://lists.xml.org/ob/adm.pl>
Thread:
Kris Thompson
Christian Nentwich
Daniel Veillard
Mike Thanos
Michael Kay
Elliotte Rusty Harold
Michael Kay
|