patch from Markus Henke, fix for recursive entities. Daniel

* tree.c: patch from Markus Henke, fix for recursive entities.
Daniel
diff --git a/tree.c b/tree.c
index 0d36ca9..086cb16 100644
--- a/tree.c
+++ b/tree.c
@@ -658,6 +658,17 @@
 			if (val != NULL) xmlFree(val);
 		        return(ret);
 		    }
+			else if ((ent != NULL) && (ent->children == NULL)) {
+				xmlNodePtr tmp;
+
+				ent->children =
+					xmlStringGetNodeList(doc, (const xmlChar*)node->content);
+				tmp = ent->children;
+				while (tmp) {
+					tmp->parent = (xmlNodePtr)ent;
+					tmp = tmp->next;
+				}
+			}
 		    if (last == NULL)
 			last = ret = node;
 		    else {
@@ -819,6 +830,17 @@
 			    if (val != NULL) xmlFree(val);
 			    return(ret);
 			}
+			else if ((ent != NULL) && (ent->children == NULL)) {
+			    xmlNodePtr temp;
+
+			    ent->children = xmlStringGetNodeList(doc,
+				    (const xmlChar*)node->content);
+			    temp = ent->children;
+			    while (temp) {
+				temp->parent = (xmlNodePtr)ent;
+				temp = temp->next;
+			    }
+			}
 			if (last == NULL) {
 			    last = ret = node;
 			} else {