summaryrefslogtreecommitdiff
path: root/ext/domxml
diff options
context:
space:
mode:
authorChristian Stocker <chregu@php.net>2002-08-22 15:54:23 +0000
committerChristian Stocker <chregu@php.net>2002-08-22 15:54:23 +0000
commit1a486b6676f523636732a265d61d1ed03d81c200 (patch)
tree28de31258040d1c5c14257e5f0626a1e8ff86513 /ext/domxml
parent1f57dec2bf33a6c1a77edc28b6cb94a9381c171a (diff)
downloadphp-git-1a486b6676f523636732a265d61d1ed03d81c200.tar.gz
@- Added XsltObject->dump_file($result,$filename[,$compression]) for dumping
@ xslt-result directly into a file. (chregu)
Diffstat (limited to 'ext/domxml')
-rw-r--r--ext/domxml/php_domxml.c42
-rw-r--r--ext/domxml/php_domxml.h1
2 files changed, 42 insertions, 1 deletions
diff --git a/ext/domxml/php_domxml.c b/ext/domxml/php_domxml.c
index 5af6f81db3..a33c06df84 100644
--- a/ext/domxml/php_domxml.c
+++ b/ext/domxml/php_domxml.c
@@ -282,7 +282,8 @@ static zend_function_entry domxml_functions[] = {
PHP_FE(domxml_xslt_stylesheet_doc, NULL)
PHP_FE(domxml_xslt_stylesheet_file, NULL)
PHP_FE(domxml_xslt_process, NULL)
- PHP_FE(domxml_xslt_dump_mem, NULL)
+ PHP_FE(domxml_xslt_dump_mem, NULL)
+ PHP_FE(domxml_xslt_dump_file, NULL)
#endif
PHP_FALIAS(domxml_add_root, domxml_doc_add_root, NULL)
@@ -523,6 +524,7 @@ static zend_function_entry php_domxsltstylesheet_class_functions[] = {
/* TODO: maybe some more methods? */
PHP_FALIAS(process, domxml_xslt_process, NULL)
PHP_FALIAS(dump_mem, domxml_xslt_dump_mem, NULL)
+ PHP_FALIAS(dump_file, domxml_xslt_dump_file, NULL)
{NULL, NULL, NULL}
};
#endif
@@ -4211,6 +4213,44 @@ PHP_FUNCTION(domxml_xslt_dump_mem)
}
/* }}} */
+/* {{{ proto int domxml_xslt_dump_file(object xslstylesheet, object xmldoc, string filename[, int compression])
+ output XSLT result to File */
+PHP_FUNCTION(domxml_xslt_dump_file)
+{
+ zval *rv, *idxsl, *idxml;
+ xsltStylesheetPtr xsltstp;
+ xmlDocPtr xmldocp;
+ xmlDocPtr docp;
+ xmlChar *doc_txt_ptr;
+ char *filename;
+ int doc_txt_len, filename_len;
+ int ret, compression = 0;
+
+ DOMXML_GET_THIS(idxsl);
+
+ xsltstp = php_xsltstylesheet_get_object(idxsl, le_domxsltstylesheetp, 0 TSRMLS_CC);
+ if (!xsltstp) {
+ php_error(E_WARNING, "%s(): underlying object missing",
+ get_active_function_name(TSRMLS_C));
+ RETURN_FALSE;
+ }
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "os|l", &idxml, &filename, &filename_len, &compression) == FAILURE) {
+ RETURN_FALSE;
+ }
+
+ DOMXML_GET_OBJ(xmldocp, idxml, le_domxmldocp);
+
+ ret = xsltSaveResultToFilename(filename, xmldocp, xsltstp, compression);
+
+ if (ret) {
+ RETURN_FALSE;
+ }
+
+ RETURN_LONG(ret);
+}
+/* }}} */
+
/* {{{ proto object domxml_parser([string buf[,string filename]])
Creates new xmlparser */
PHP_FUNCTION(domxml_parser)
diff --git a/ext/domxml/php_domxml.h b/ext/domxml/php_domxml.h
index 0c799f5253..be6a8ca5a5 100644
--- a/ext/domxml/php_domxml.h
+++ b/ext/domxml/php_domxml.h
@@ -230,6 +230,7 @@ PHP_FUNCTION(domxml_xslt_stylesheet_doc);
PHP_FUNCTION(domxml_xslt_stylesheet_file);
PHP_FUNCTION(domxml_xslt_process);
PHP_FUNCTION(domxml_xslt_dump_mem);
+PHP_FUNCTION(domxml_xslt_dump_file);
PHP_FUNCTION(domxml_xslt_version);
#endif
typedef struct {