summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Richards <rrichards@php.net>2004-07-18 13:47:44 +0000
committerRob Richards <rrichards@php.net>2004-07-18 13:47:44 +0000
commit5c17925a7c93598835d1424c083b53a53131397d (patch)
tree254a4d5c46c2d7b05a4679dcba876b53a1f6614c
parenta7f36a582552ef33b561dabaf961db2c1ba1d5c9 (diff)
downloadphp-git-5c17925a7c93598835d1424c083b53a53131397d.tar.gz
add appendXML() to DOMFragment (chregu)
-rw-r--r--ext/dom/documentfragment.c29
-rw-r--r--ext/dom/dom_fe.h1
2 files changed, 30 insertions, 0 deletions
diff --git a/ext/dom/documentfragment.c b/ext/dom/documentfragment.c
index 14f761df89..0fed1a81d4 100644
--- a/ext/dom/documentfragment.c
+++ b/ext/dom/documentfragment.c
@@ -37,6 +37,7 @@
zend_function_entry php_dom_documentfragment_class_functions[] = {
PHP_ME(domdocumentfragment, __construct, NULL, ZEND_ACC_PUBLIC)
+ PHP_ME(domdocumentfragment, appendXML, NULL, ZEND_ACC_PUBLIC)
{NULL, NULL, NULL}
};
@@ -73,4 +74,32 @@ PHP_METHOD(domdocumentfragment, __construct)
}
}
/* }}} end DOMDocumentFragment::__construct */
+
+/* {{{ proto void DOMDocumentFragment::appendXML(string data); */
+PHP_METHOD(domdocumentfragment, appendXML) {
+ zval *id;
+ xmlNode *nodep;
+ dom_object *intern;
+ char *data = NULL;
+ int data_len = 0;
+ int err;
+ xmlNodePtr lst;
+
+ if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &id, dom_documentfragment_class_entry, &data, &data_len) == FAILURE) {
+ return;
+ }
+
+ DOM_GET_OBJ(nodep, id, xmlNodePtr, intern);
+
+ if (data) {
+ err = xmlParseBalancedChunkMemory(nodep->doc, NULL, NULL, 0, data, &lst);
+ if (err != 0) {
+ RETURN_FALSE;
+ }
+ xmlAddChildList(nodep,lst);
+ }
+
+ RETURN_TRUE;
+}
+
#endif
diff --git a/ext/dom/dom_fe.h b/ext/dom/dom_fe.h
index 3d860a54be..913c5dded7 100644
--- a/ext/dom/dom_fe.h
+++ b/ext/dom/dom_fe.h
@@ -102,6 +102,7 @@ PHP_METHOD(domimplementation, getFeature);
/* domdocumentfragment methods */
PHP_METHOD(domdocumentfragment, __construct);
+PHP_METHOD(domdocumentfragment, appendXML);
/* domdocument methods */
PHP_FUNCTION(dom_document_create_element);