Re: [xml] Xpath question



On Mon, Jun 02, 2008 at 06:20:07PM -0700, Yong Chen (yongche) wrote:

Hi,

Got a question regarding xpath usage in libxml2.

If I have a document doc, which contains some nodes, say n1, n2, n3.

Now I have an xpath as:  "/bookstore/book[1]/title"

Do we have any api that can evaluate node "n1" and tell me that if we
were to apply this xpath string to the document, then n1 would be
selected (or not).

Basically I want to evaluate an xpath on node basis, not the full
document basis.

  The closest is the patter module, but that works only on a subset
of XPath

   http://xmlsoft.org/html/libxml-pattern.html

you will have to look at the code in XPath/Schemas to get an idea on how
to use it, as there isn't much documentation.

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]