1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-12-24 21:33:51 +03:00

Make sure that new object carry the proper type value, Daniel.

This commit is contained in:
Daniel Veillard 1998-10-18 19:12:41 +00:00
parent 27fb07571f
commit 33942846fc
2 changed files with 15 additions and 0 deletions

View File

@ -1,3 +1,8 @@
Sun Oct 18 15:08:19 EDT 1998 Daniel Veillard <Daniel.Veillard@w3.org>
* 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 <Daniel.Veillard@w3.org> Sat Oct 17 02:43:21 EDT 1998 Daniel Veillard <Daniel.Veillard@w3.org>
* tree.h, tree.c: Ok, the main objects in the tree will be native * tree.h, tree.c: Ok, the main objects in the tree will be native

10
tree.c
View File

@ -268,6 +268,7 @@ xmlDocPtr xmlNewDoc(const CHAR *version) {
return(NULL); return(NULL);
} }
cur->type = XML_DOCUMENT_NODE;
cur->version = xmlStrdup(version); cur->version = xmlStrdup(version);
cur->name = NULL; cur->name = NULL;
cur->root = NULL; cur->root = NULL;
@ -323,6 +324,7 @@ xmlAttrPtr xmlNewProp(xmlNodePtr node, const CHAR *name, const CHAR *value) {
return(NULL); return(NULL);
} }
cur->type = XML_ATTRIBUTE_NODE;
cur->node = node; cur->node = node;
cur->name = xmlStrdup(name); cur->name = xmlStrdup(name);
if (value != NULL) if (value != NULL)
@ -404,6 +406,7 @@ xmlNodePtr xmlNewNode(xmlNsPtr ns, const CHAR *name, CHAR *content) {
return(NULL); return(NULL);
} }
cur->type = XML_ELEMENT_NODE;
cur->doc = NULL; cur->doc = NULL;
cur->parent = NULL; cur->parent = NULL;
cur->next = NULL; cur->next = NULL;
@ -450,6 +453,7 @@ xmlNodePtr xmlNewText(const CHAR *content) {
return(NULL); return(NULL);
} }
cur->type = XML_TEXT_NODE;
cur->doc = NULL; cur->doc = NULL;
cur->parent = NULL; cur->parent = NULL;
cur->next = NULL; cur->next = NULL;
@ -490,6 +494,7 @@ xmlNodePtr xmlNewTextLen(const CHAR *content, int len) {
return(NULL); return(NULL);
} }
cur->type = XML_TEXT_NODE;
cur->doc = NULL; cur->doc = NULL;
cur->parent = NULL; cur->parent = NULL;
cur->prev = NULL; cur->prev = NULL;
@ -530,6 +535,7 @@ xmlNodePtr xmlNewComment(CHAR *content) {
return(NULL); return(NULL);
} }
cur->type = XML_COMMENT_NODE;
cur->doc = NULL; cur->doc = NULL;
cur->parent = NULL; cur->parent = NULL;
cur->prev = 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. * 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->parent = parent;
cur->doc = parent->doc; cur->doc = parent->doc;
if (parent->childs == NULL) { if (parent->childs == NULL) {