rrichards               Sun Dec  5 07:02:35 2004 EDT

  Modified files:              
    /php-src/ext/simplexml      simplexml.c 
  Log:
  add optional parameter to pass libxml document load options
  
http://cvs.php.net/diff.php/php-src/ext/simplexml/simplexml.c?r1=1.146&r2=1.147&ty=u
Index: php-src/ext/simplexml/simplexml.c
diff -u php-src/ext/simplexml/simplexml.c:1.146 
php-src/ext/simplexml/simplexml.c:1.147
--- php-src/ext/simplexml/simplexml.c:1.146     Mon Aug 30 13:29:22 2004
+++ php-src/ext/simplexml/simplexml.c   Sun Dec  5 07:02:35 2004
@@ -18,7 +18,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: simplexml.c,v 1.146 2004/08/30 17:29:22 rrichards Exp $ */
+/* $Id: simplexml.c,v 1.147 2004/12/05 12:02:35 rrichards Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -1260,7 +1260,7 @@
 }
 /* }}} */
 
-/* {{{ proto simplemxml_element simplexml_load_file(string filename [, string 
class_name])
+/* {{{ proto simplemxml_element simplexml_load_file(string filename [, string 
class_name [, int options]])
    Load a filename and return a simplexml_element object to allow for 
processing */
 PHP_FUNCTION(simplexml_load_file)
 {
@@ -1269,14 +1269,19 @@
        int             filename_len;
        xmlDocPtr       docp;
        char           *classname = "";
-       int             classname_len = 0;
+       int             classname_len = 0, options=0;
        zend_class_entry *ce= sxe_class_entry;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &filename, 
&filename_len, &classname, &classname_len) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|sl", &filename, 
&filename_len, &classname, &classname_len, &options) == FAILURE) {
                return;
        }
 
+#if LIBXML_VERSION >= 20600
+       docp = xmlReadFile(filename, NULL, options);
+#else
        docp = xmlParseFile(filename);
+#endif
+
        if (! docp) {
                RETURN_FALSE;
        }
@@ -1298,7 +1303,7 @@
 }
 /* }}} */
 
-/* {{{ proto simplemxml_element simplexml_load_string(string data [, string 
class_name])
+/* {{{ proto simplemxml_element simplexml_load_string(string data [, string 
class_name [, int options]])
    Load a string and return a simplexml_element object to allow for processing 
*/
 PHP_FUNCTION(simplexml_load_string)
 {
@@ -1307,14 +1312,19 @@
        int             data_len;
        xmlDocPtr       docp;
        char           *classname = "";
-       int             classname_len = 0;
+       int             classname_len = 0, options=0;
        zend_class_entry *ce= sxe_class_entry;
 
-       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &data, 
&data_len, &classname, &classname_len) == FAILURE) {
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|sl", &data, 
&data_len, &classname, &classname_len, &options) == FAILURE) {
                return;
        }
 
+#if LIBXML_VERSION >= 20600
+       docp = xmlReadMemory(data, data_len, NULL, NULL, options);
+#else
        docp = xmlParseMemory(data, data_len);
+#endif
+
        if (! docp) {
                RETURN_FALSE;
        }
@@ -1719,7 +1729,7 @@
 {
        php_info_print_table_start();
        php_info_print_table_header(2, "Simplexml support", "enabled");
-       php_info_print_table_row(2, "Revision", "$Revision: 1.146 $");
+       php_info_print_table_row(2, "Revision", "$Revision: 1.147 $");
        php_info_print_table_row(2, "Schema support",
 #ifdef LIBXML_SCHEMAS_ENABLED
                "enabled");

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to