[XML-SIG] node identity with libxml2

Daniel Veillard veillard at redhat.com
Thu Jan 29 06:56:22 EST 2004


On Thu, Jan 29, 2004 at 11:40:21AM +0000, Matt Patterson wrote:
> Hello,
> 
> I'm using libxml2 and I'm trying to determine the intersection of two 
> lists of nodes, where each list is a leaf-to-root chain of ancestors. 
> The lists do have a point of intersection.
> 
> printing the trees shows this:
> 
> tree1: [<xmlNode (start) object at 0x6d788>, <xmlNode (alpha) object at 
> 0x6de18>]
> tree2: [<xmlNode (end) object at 0x6d878>, <xmlNode (alpha) object at 
> 0x6df08>]
> 
> (I've snipped the ends of the lists for clarity.)
> 
> Now, I know that the <xmlNode (alpha) object> in each list are 
> references to the same node: There's only one <alpha> element in the 
> entire document. However, if I do tree1[1] == tree2[1] it returns 
> false, which is a problem.

  right, the underlying C object are the same but new wrappers are build
on the fly. The equality should be defined by testing the C objects pointers,
I don't know how to do this, 

Daniel

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard at redhat.com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



More information about the XML-SIG mailing list