Make sure that new object carry the proper type value, Daniel.
diff --git a/tree.c b/tree.c
index 72287a2..5b06b28 100644
--- a/tree.c
+++ b/tree.c
@@ -268,6 +268,7 @@
return(NULL);
}
+ cur->type = XML_DOCUMENT_NODE;
cur->version = xmlStrdup(version);
cur->name = NULL;
cur->root = NULL;
@@ -323,6 +324,7 @@
return(NULL);
}
+ cur->type = XML_ATTRIBUTE_NODE;
cur->node = node;
cur->name = xmlStrdup(name);
if (value != NULL)
@@ -404,6 +406,7 @@
return(NULL);
}
+ cur->type = XML_ELEMENT_NODE;
cur->doc = NULL;
cur->parent = NULL;
cur->next = NULL;
@@ -450,6 +453,7 @@
return(NULL);
}
+ cur->type = XML_TEXT_NODE;
cur->doc = NULL;
cur->parent = NULL;
cur->next = NULL;
@@ -490,6 +494,7 @@
return(NULL);
}
+ cur->type = XML_TEXT_NODE;
cur->doc = NULL;
cur->parent = NULL;
cur->prev = NULL;
@@ -530,6 +535,7 @@
return(NULL);
}
+ cur->type = XML_COMMENT_NODE;
cur->doc = NULL;
cur->parent = NULL;
cur->prev = NULL;
@@ -584,6 +590,10 @@
/*
* add the new element at the end of the childs list.
*/
+ if (content == NULL)
+ cur->type = XML_ELEMENT_NODE;
+ else
+ cur->type = XML_TEXT_NODE;
cur->parent = parent;
cur->doc = parent->doc;
if (parent->childs == NULL) {