add appendXML() to DOMFragment (chregu)

This commit is contained in:
Rob Richards 2004-07-18 13:47:44 +00:00
parent a7f36a5825
commit 5c17925a7c
2 changed files with 30 additions and 0 deletions

View 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

View 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);