summaryrefslogtreecommitdiff
path: root/ext/domxml
diff options
context:
space:
mode:
authorUwe Steinmann <steinm@php.net>2000-02-09 14:07:44 +0000
committerUwe Steinmann <steinm@php.net>2000-02-09 14:07:44 +0000
commit9603c7cc8371aed151d43cb8edbe792a8112089e (patch)
treec45b9d250fc30394a18681fac8c820c5c3b7cd44 /ext/domxml
parent06c586932a4d1a91afc1cc158c63105998af19a5 (diff)
downloadphp-git-9603c7cc8371aed151d43cb8edbe792a8112089e.tar.gz
- new function to read and parse xml doc from file
Diffstat (limited to 'ext/domxml')
-rw-r--r--ext/domxml/domxml.c29
-rw-r--r--ext/domxml/php_domxml.h1
2 files changed, 30 insertions, 0 deletions
diff --git a/ext/domxml/domxml.c b/ext/domxml/domxml.c
index 9358a08b99..e07f0f08f5 100644
--- a/ext/domxml/domxml.c
+++ b/ext/domxml/domxml.c
@@ -35,7 +35,9 @@ static zend_class_entry *domxmlattr_class_entry_ptr;
static zend_function_entry php_domxml_functions[] = {
PHP_FE(getdom, NULL)
+ PHP_FE(getdomfile, NULL)
PHP_FALIAS(dom, getdom, NULL)
+ PHP_FALIAS(domfile, getdomfile, NULL)
PHP_FE(domxml_root, NULL)
PHP_FE(domxml_addroot, NULL)
PHP_FE(domxml_dumpmem, NULL)
@@ -697,6 +699,33 @@ PHP_FUNCTION(getdom)
}
/* }}} */
+/* {{{ proto class dom(string filename)
+ Creates dom object of xml document in file*/
+PHP_FUNCTION(getdomfile)
+{
+ pval *arg;
+ xmlDoc *docp;
+ int ret;
+
+ if (ARG_COUNT(ht) != 1 || getParameters(ht, 1, &arg) == FAILURE) {
+ WRONG_PARAM_COUNT;
+ }
+ convert_to_string(arg);
+
+ docp = xmlParseFile(arg->value.str.val);
+ if (!docp) {
+ RETURN_FALSE;
+ }
+ ret = zend_list_insert(docp, le_domxmldocp);
+
+ /* construct an object with some methods */
+ object_init_ex(return_value, domxmldoc_class_entry_ptr);
+ add_property_long(return_value, "doc", ret);
+ add_property_stringl(return_value, "version", (char *) docp->version, strlen(docp->version), 1);
+ zend_list_addref(ret);
+}
+/* }}} */
+
/* {{{ proto string domxml_newchild([int node_handle], string name, string content)
Adds child node to parent node */
PHP_FUNCTION(domxml_newchild)
diff --git a/ext/domxml/php_domxml.h b/ext/domxml/php_domxml.h
index 36ff9807b5..1c3f6e759f 100644
--- a/ext/domxml/php_domxml.h
+++ b/ext/domxml/php_domxml.h
@@ -44,6 +44,7 @@ extern zend_module_entry php_domxml_module_entry;
extern PHP_MINIT_FUNCTION(domxml);
extern PHP_MINFO_FUNCTION(domxml);
PHP_FUNCTION(getdom);
+PHP_FUNCTION(getdomfile);
PHP_FUNCTION(domxml_newxmldoc);
/* Class Document methods */