Aha, thanks!
Still there is a problem with sorting a document node. It can be fixed either
by prepending the following to xmlXPathCmpNodes(Ext) functions:
if (node1->type == XML_DOCUMENT_NODE && node2->type == XML_DOCUMENT_NODE)
return(0);
else if (node1->type == XML_DOCUMENT_NODE)
return(1);
else if (node2->type == XML_DOCUMENT_NODE)
return(-1);
or by actually fixing it somewhere inside, probably here:
for (depth2 = 0, cur = node2;cur->parent != NULL;cur = cur->parent) {
if (cur == node1)
return(1);
depth2++;
}
root = cur;
for (depth1 = 0, cur = node1;cur->parent != NULL;cur = cur->parent) {
if (cur == node2)
return(-1);
depth1++;
}
Vojtech
-----Original Message-----
From: Bjoern Hoehrmann [mailto:[email protected]]
Sent: 20. září 2012 13:52
To: Vojtech Fried
Cc: [email protected]
Subject: Re: [xml] document node
* Vojtech Fried wrote:
>I would expect XPath '/data/message/ancestor-or-self::*' to return
>three
>nodes: document node (the node with type XML_DOCUMENT_NODE), 'data'
>node (the root node) and 'message' node. I don't get the document node
>though.
The node test `*` matches only element nodes; use `node()` instead.
--
Björn Höhrmann . mailto:[email protected] . http://bjoern.hoehrmann.de Am
Badedeich 7 . Telefon: +49(0)160/4415681 . http://www.bjoernsworld.de
25899 Dagebüll . PGP Pub. KeyID: 0xA4357E78 . http://www.websitedev.de/
_______________________________________________
xml mailing list, project page http://xmlsoft.org/
[email protected]
https://mail.gnome.org/mailman/listinfo/xml