summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSterling Hughes <sterling@php.net>2003-05-19 13:33:01 +0000
committerSterling Hughes <sterling@php.net>2003-05-19 13:33:01 +0000
commitb3772c4f35e48fd58f05f07c099f3e348d46f282 (patch)
treee54e4c158eb7b6c7cc7b2787483ca4a50d1f8cf0
parent08bf40244031b99054cc7d27490790ca1259190e (diff)
downloadphp-git-b3772c4f35e48fd58f05f07c099f3e348d46f282.tar.gz
add the ability to serialize the contents back to a file
-rw-r--r--ext/simplexml/simplexml.c21
1 files changed, 21 insertions, 0 deletions
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}
};