Re: [xml] Xpath question

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


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

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.


Red Hat Virtualization group
Daniel Veillard      | virtualization library
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

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