From: Sterling Hughes Date: Mon, 19 May 2003 13:33:01 +0000 (+0000) Subject: add the ability to serialize the contents back to a file X-Git-Tag: RELEASE_1_0_2~741 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b3772c4f35e48fd58f05f07c099f3e348d46f282;p=php add the ability to serialize the contents back to a file --- diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c index e00c045622..4c207253d9 100644 --- a/ext/simplexml/simplexml.c +++ b/ext/simplexml/simplexml.c @@ -392,9 +392,30 @@ PHP_FUNCTION(simplexml_load_file) } /* }}} */ +/* {{{ proto bool simplexml_save_file(string filename, simplexml_element node) + Save a document from a SimpleXML node */ +PHP_FUNCTION(simplexml_save_document_file) +{ + php_sxe_object *sxe; + zval *element; + char *filename; + int filename_len; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz", &filename, &filename_len, &element) == FAILURE) { + return; + } + + sxe = php_sxe_fetch_object(element TSRMLS_CC); + + xmlSaveFile(filename, sxe->document); + + RETURN_TRUE; +} +/* }}} */ function_entry simplexml_functions[] = { PHP_FE(simplexml_load_file, NULL) + PHP_FE(simplexml_save_document_file, NULL) {NULL, NULL, NULL} };