summaryrefslogtreecommitdiff
path: root/tree.c
diff options
context:
space:
mode:
authorDaniel Veillard <veillard@src.gnome.org>2003-11-01 17:04:58 +0000
committerDaniel Veillard <veillard@src.gnome.org>2003-11-01 17:04:58 +0000
commit254b12607d427687ae5c1bd75fabaf2ca530b65e (patch)
tree93bb0089af082c4322d3599c39352c7ad7ad366c /tree.c
parent375bf669d17d8e1ebe979777f6dd97ba4a27ee80 (diff)
downloadlibxml2-254b12607d427687ae5c1bd75fabaf2ca530b65e.tar.gz
second BeOS patch from Marcin 'Shard' Konicki Daniel
* tree.c nanohttp.c threads.c: second BeOS patch from Marcin 'Shard' Konicki Daniel
Diffstat (limited to 'tree.c')
-rw-r--r--tree.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/tree.c b/tree.c
index 0d984e2d..59faab7e 100644
--- a/tree.c
+++ b/tree.c
@@ -2375,10 +2375,22 @@ xmlNewTextChild(xmlNodePtr parent, xmlNsPtr ns,
/*
* Allocate a new node
*/
- if (ns == NULL)
- cur = xmlNewDocRawNode(parent->doc, parent->ns, name, content);
- else
- cur = xmlNewDocRawNode(parent->doc, ns, name, content);
+ if (parent->type == XML_ELEMENT_NODE) {
+ if (ns == NULL)
+ cur = xmlNewDocRawNode(parent->doc, parent->ns, name, content);
+ else
+ cur = xmlNewDocRawNode(parent->doc, ns, name, content);
+ } else if ((parent->type == XML_DOCUMENT_NODE) ||
+ (parent->type == XML_HTML_DOCUMENT_NODE)) {
+ if (ns == NULL)
+ cur = xmlNewDocRawNode((xmlDocPtr) parent, NULL, name, content);
+ else
+ cur = xmlNewDocRawNode((xmlDocPtr) parent, ns, name, content);
+ } else if (parent->type == XML_DOCUMENT_FRAG_NODE) {
+ cur = xmlNewDocRawNode( parent->doc, ns, name, content);
+ } else {
+ return(NULL);
+ }
if (cur == NULL) return(NULL);
/*