]> granicus.if.org Git - php/commitdiff
add appendXML() to DOMFragment (chregu)
authorRob Richards <rrichards@php.net>
Sun, 18 Jul 2004 13:47:44 +0000 (13:47 +0000)
committerRob Richards <rrichards@php.net>
Sun, 18 Jul 2004 13:47:44 +0000 (13:47 +0000)
ext/dom/documentfragment.c
ext/dom/dom_fe.h

index 14f761df894d42584dc672f473b02f72740c4c9c..0fed1a81d4ab3395925c8dd985d21d439589ccf5 100644 (file)
@@ -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
index 3d860a54bea16a0d012db80e4233b22997cebf06..913c5dded7cf276033d344d76bbc671ba4d6dc06 100644 (file)
@@ -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);