Re: [xml] xmlXPathEval(*str,*ctxt)



On Thu, Mar 28, 2002 at 09:47:24AM -0500, Robert G. Brown wrote:
It seems that in a document like:

<?xml version="1.0"?>
<xmlsysd>
  <proc>
  </proc>
</xmlsysd>

rgb lucifer|T:443>./testXPath -i xmlsysd.xml /xmlsysd/proc/uptime
Object is a Node Set :
Set contains 0 nodes:
rgb lucifer|T:444>./testXPath -i xmlsysd.xml /xmlsysd/proc/uptime/up
Object is a Node Set :
NodeSet is NULL !
rgb lucifer|T:457>./testXPath -i xmlsysd.xml /xmlsysd/proc
Object is a Node Set :
Set contains 1 nodes:
1  ELEMENT proc

In my own code the following fragment (either way -- one step or with a
segment copied from textXPath.c) does NOT return null in the second case
although the node obviously does not exist.  Is this not a bug?  Do I
have to test all segments of a path to a node?

  it's not a bug. ht eobject recturned will not be null in either
case, in both case it will be flagged as a being a node set in 
the first case obj->nodeset is not NULL and is of zero len and in
the second case obj->nodeset is NULL.
  They have the same semantic.

  it simply won't allocate a node set array if not needed.

Daniel

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
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]