From 33942846fc167ce77c69064ac78cba94c462b46e Mon Sep 17 00:00:00 2001 From: Daniel Veillard Date: Sun, 18 Oct 1998 19:12:41 +0000 Subject: [PATCH] Make sure that new object carry the proper type value, Daniel. --- ChangeLog | 5 +++++ tree.c | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/ChangeLog b/ChangeLog index 6f1cdfb3..41f995d0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sun Oct 18 15:08:19 EDT 1998 Daniel Veillard + + * tree.c : make sure that the type id is properly set-up when + a new object is allocated, needed for DOM. + Sat Oct 17 02:43:21 EDT 1998 Daniel Veillard * tree.h, tree.c: Ok, the main objects in the tree will be native diff --git a/tree.c b/tree.c index 72287a2f..5b06b280 100644 --- a/tree.c +++ b/tree.c @@ -268,6 +268,7 @@ xmlDocPtr xmlNewDoc(const CHAR *version) { return(NULL); } + cur->type = XML_DOCUMENT_NODE; cur->version = xmlStrdup(version); cur->name = NULL; cur->root = NULL; @@ -323,6 +324,7 @@ xmlAttrPtr xmlNewProp(xmlNodePtr node, const CHAR *name, const CHAR *value) { return(NULL); } + cur->type = XML_ATTRIBUTE_NODE; cur->node = node; cur->name = xmlStrdup(name); if (value != NULL) @@ -404,6 +406,7 @@ xmlNodePtr xmlNewNode(xmlNsPtr ns, const CHAR *name, CHAR *content) { return(NULL); } + cur->type = XML_ELEMENT_NODE; cur->doc = NULL; cur->parent = NULL; cur->next = NULL; @@ -450,6 +453,7 @@ xmlNodePtr xmlNewText(const CHAR *content) { return(NULL); } + cur->type = XML_TEXT_NODE; cur->doc = NULL; cur->parent = NULL; cur->next = NULL; @@ -490,6 +494,7 @@ xmlNodePtr xmlNewTextLen(const CHAR *content, int len) { return(NULL); } + cur->type = XML_TEXT_NODE; cur->doc = NULL; cur->parent = NULL; cur->prev = NULL; @@ -530,6 +535,7 @@ xmlNodePtr xmlNewComment(CHAR *content) { return(NULL); } + cur->type = XML_COMMENT_NODE; cur->doc = NULL; cur->parent = NULL; cur->prev = NULL; @@ -584,6 +590,10 @@ xmlNodePtr xmlNewChild(xmlNodePtr parent, xmlNsPtr ns, /* * 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) {