summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS1
-rw-r--r--ext/domxml/domxml.c8
-rw-r--r--tests/testdom6
3 files changed, 11 insertions, 4 deletions
diff --git a/NEWS b/NEWS
index 0b48e146c8..1936ab0992 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,7 @@ PHP 4.0 NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ?? ????, Version 4.0 Beta 4
+- Added domxml extension based on libxml, still little functionality (Uwe)
- Fixed memory corruption in fgetss(), strip_tags() and gzgetss() (Zeev)
- Updated calendar dynamic library to work with PHP4. (Evan)
- Added strncmp() function, courtesy of Walter. (Andrei)
diff --git a/ext/domxml/domxml.c b/ext/domxml/domxml.c
index c71089120c..9358a08b99 100644
--- a/ext/domxml/domxml.c
+++ b/ext/domxml/domxml.c
@@ -735,7 +735,10 @@ PHP_FUNCTION(domxml_newchild)
RETURN_FALSE;
}
- child = xmlNewChild(nodep, NULL, name->value.str.val, content->value.str.val);
+ if(content->value.str.len)
+ child = xmlNewChild(nodep, NULL, name->value.str.val, content->value.str.val);
+ else
+ child = xmlNewChild(nodep, NULL, name->value.str.val, NULL);
if (!child) {
RETURN_FALSE;
}
@@ -743,7 +746,7 @@ PHP_FUNCTION(domxml_newchild)
/* construct an object with some methods */
object_init_ex(return_value, domxmlnode_class_entry_ptr);
- add_property_long(return_value, "child", ret);
+ add_property_long(return_value, "node", ret);
add_property_long(return_value, "type", child->type);
add_property_stringl(return_value, "name", (char *) child->name, strlen(child->name), 1);
if(content->value.str.val)
@@ -794,6 +797,7 @@ PHP_FUNCTION(domxml_addroot)
if (!node) {
RETURN_FALSE;
}
+ docp->root = node;
ret = zend_list_insert(node, le_domxmlnodep);
/* construct an object with some methods */
diff --git a/tests/testdom b/tests/testdom
index 3b850f4ef9..d8d3d12d3e 100644
--- a/tests/testdom
+++ b/tests/testdom
@@ -63,9 +63,11 @@ output_node($rootnode);
$doc = newxmldoc("1.0");
$root = $doc->addroot("HTML");
-echo $root->name;
$root->newchild("TITLE", "Hier der Titel");
-$root->newchild("BODY", "");
+$body = $root->newchild("BODY", "");
+$table = $body->newchild("TABLE", "");
+$table->setattr("WIDTH", "100%");
+$table->newchild("TR", " ");
echo $doc->dumpmem();
?>