summaryrefslogtreecommitdiff
path: root/xinclude.c
diff options
context:
space:
mode:
Diffstat (limited to 'xinclude.c')
-rw-r--r--xinclude.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/xinclude.c b/xinclude.c
index 484cd6d..347e0ad 100644
--- a/xinclude.c
+++ b/xinclude.c
@@ -2194,7 +2194,7 @@ xmlXIncludeDoProcess(xmlXIncludeCtxtPtr ctxt, xmlDocPtr doc, xmlNodePtr tree) {
cur = tree;
if (xmlXIncludeTestNode(ctxt, cur) == 1)
xmlXIncludePreProcessNode(ctxt, cur);
- while (cur != NULL) {
+ while ((cur != NULL) && (cur != tree->parent)) {
/* TODO: need to work on entities -> stack */
if ((cur->children != NULL) &&
(cur->children->type != XML_ENTITY_DECL) &&
@@ -2212,7 +2212,8 @@ xmlXIncludeDoProcess(xmlXIncludeCtxtPtr ctxt, xmlDocPtr doc, xmlNodePtr tree) {
break;
do {
cur = cur->parent;
- if (cur == NULL) break; /* do */
+ if ((cur == NULL) || (cur == tree->parent))
+ break; /* do */
if (cur->next != NULL) {
cur = cur->next;
if (xmlXIncludeTestNode(ctxt, cur))