1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-07-30 22:43:14 +03:00

fixing #96925 wich was also dependant on the processing of parsed

* parser.c xpath.c: fixing #96925 wich was also dependant on the
  processing of parsed entities, and XPath computation on sustitued
  entities.
* testXPath.c: make sure entities are substitued.
Daniel
This commit is contained in:
Daniel Veillard
2002-11-16 15:35:11 +00:00
parent 328f48c101
commit 68e9e74af8
4 changed files with 62 additions and 43 deletions

26
xpath.c
View File

@ -1367,6 +1367,10 @@ xmlXPathCmpNodes(xmlNodePtr node1, xmlNodePtr node2) {
if (node1 == node2->next)
return(-1);
#if 0
Unfortunately this does not work. Line number in entities reset
to 1 within the entity :-(
/*
* Speedup using line numbers if availble.
*/
@ -1381,7 +1385,7 @@ xmlXPathCmpNodes(xmlNodePtr node1, xmlNodePtr node2) {
if (l1 > l2)
return(-1);
}
#endif
/*
* compute depth to root
*/
@ -5169,13 +5173,27 @@ xmlXPathNextDescendant(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) {
}
if (cur->children != NULL) {
if (cur->children->type != XML_ENTITY_DECL)
return(cur->children);
/*
* Do not descend on entities declarations
*/
if (cur->children->type != XML_ENTITY_DECL) {
cur = cur->children;
/*
* Skip DTDs
*/
if (cur->type != XML_DTD_NODE)
return(cur);
}
}
if (cur == ctxt->context->node) return(NULL);
if (cur->next != NULL) return(cur->next);
while (cur->next != NULL) {
cur = cur->next;
if ((cur->type != XML_ENTITY_DECL) &&
(cur->type != XML_DTD_NODE))
return(cur);
}
do {
cur = cur->parent;