[xml] XPath Lack ?

Date view Thread view Subject view Author view

From: Stefan Bambach (bambach@triplex.de)
Date: Thu Oct 26 2000 - 10:31:52 EDT


Hi Daniel and all others,

I have some troubles with XPath functions:

xmlXPathContextPtr xmlXPathNewContext(xmlDocPtr doc);
xmlXPathObjectPtr xmlXPathEval(const xmlChar *str, xmlXPathContextPtr ctxt);

I use these two function (and some other of course) to get some XPath
objects. Is there a way that I can give a node ptr to newcontext ? So
that all results are from within this node ?

e.g.
<TAG1>
  <TAG2>
    <A NAME="name_hehe1"/>
    <A NAME="name_hehe2"/>
    <A HREF="hehe"/>
  </TAG2>
  <TAG3>
    <A NAME="name_huhu1"/>
   <A NAME="name_huhu1"/>
    <A HREF="huhu"/>
  </TAG3>
  <TAG4>
    <A NAME="name_haha1"/>
    <A NAME="name_haha2"/>
    <A HREF="haha"/>
  </TAG4>
</TAG1>

Let's say that this is my XPath expression:
  XPath = "A/@NAME"
Now I want all results from within TAG3, that should be data from
TAGs: <A NAME="name_huhu1"/>
        <A NAME="name_huhu1"/>

MY PROBLEM:
You can only have XPath expressions that are from root element ('/').
So my expression "A/@NAME" would not find anything because there is no
such element from root. I switched to "//A/@NAME". Now I got 6 results
of course and not only my two within TAG3.

Is there any functionallity in this way:
  xmlXPathNewContext(xmlNodePtr node); ??????????

Mit freundlichen Grüssen.
Stefan Bambach

-- 
Stefan Bambach

triplex-agentur fuer neue medien GmbH herzog-heinrich-strasse 11-13 80336 muenchen

tel: 089-209 138 29 fax: 089-209 138 10

mailto:bambach@triplex.de http://www.triplex.de

---- Message from the list xml@rpmfind.net Archived at : http://xmlsoft.org/messages/ to unsubscribe: echo "unsubscribe xml" | mail majordomo@rpmfind.net


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Thu Oct 26 2000 - 10:43:49 EDT