cvs: php4 /ext/domxml php_domxml.c php_domxml.h
| From: | Christian Stocker | Date: | Thu, 13 Jun 2002 10:47:20 +0000 |
| Subject: | cvs: php4 /ext/domxml php_domxml.c php_domxml.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-12344@lists.php.net to get a copy of this message | ||
chregu Thu Jun 13 06:47:20 2002 EDT
Modified files:
/php4/ext/domxml php_domxml.c php_domxml.h
Log:
- Added DOMXML_LOAD_DONT_KEEP_BLANKS as possible mode, if one wants really nicely
formatted XML-Documents (but this can have sideeffects, if you depend on whitespaces..)
- bumped up domxml-api-version number.
Index: php4/ext/domxml/php_domxml.c
diff -u php4/ext/domxml/php_domxml.c:1.168 php4/ext/domxml/php_domxml.c:1.169
--- php4/ext/domxml/php_domxml.c:1.168 Thu Jun 13 05:05:56 2002
+++ php4/ext/domxml/php_domxml.c Thu Jun 13 06:47:18 2002
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_domxml.c,v 1.168 2002/06/13 09:05:56 chregu Exp $ */
+/* $Id: php_domxml.c,v 1.169 2002/06/13 10:47:18 chregu Exp $ */
/* TODO
* - Support Notation Nodes
@@ -137,7 +137,7 @@
#define DOMXML_LOAD_RECOVERING 2
#define DOMXML_LOAD_SUBSTITUTE_ENTITIES 4
#define DOMXML_LOAD_COMPLETE_ATTRS 8
-
+#define DOMXML_LOAD_DONT_KEEP_BLANKS 16
static int le_domxmldocp;
static int le_domxmldoctypep;
static int le_domxmldtdp;
@@ -1573,7 +1573,7 @@
REGISTER_LONG_CONSTANT("DOMXML_LOAD_RECOVERING", DOMXML_LOAD_RECOVERING, CONST_CS |
CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("DOMXML_LOAD_SUBSTITUTE_ENTITIES", DOMXML_LOAD_SUBSTITUTE_ENTITIES, CONST_CS
| CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("DOMXML_LOAD_COMPLETE_ATTRS",DOMXML_LOAD_COMPLETE_ATTRS, CONST_CS
| CONST_PERSISTENT);
-
+ REGISTER_LONG_CONSTANT("DOMXML_LOAD_DONT_KEEP_BLANKS",DOMXML_LOAD_DONT_KEEP_BLANKS, CONST_CS
| CONST_PERSISTENT);
xmlSetGenericErrorFunc(xmlGenericErrorContext, (xmlGenericErrorFunc)domxml_error);
#if HAVE_DOMXSLT
xsltSetGenericErrorFunc(xsltGenericErrorContext, (xmlGenericErrorFunc)domxml_error);
@@ -3538,6 +3538,7 @@
int buffer_len;
int mode = 0, prevSubstValue;
int oldvalue = xmlDoValidityCheckingDefaultValue;
+ int oldvalue_keepblanks;
zval *errors ;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lz", &buffer,
&buffer_len, &mode, &errors) == FAILURE) {
@@ -3550,6 +3551,11 @@
zval_dtor(errors);
array_init(errors);
}
+
+ if (mode & DOMXML_LOAD_DONT_KEEP_BLANKS)
+ oldvalue_keepblanks = xmlKeepBlanksDefault(0);
+ else
+ oldvalue_keepblanks = xmlKeepBlanksDefault(1);
if(mode & DOMXML_LOAD_SUBSTITUTE_ENTITIES)
prevSubstValue = xmlSubstituteEntitiesDefault (1);
@@ -3587,6 +3593,7 @@
}
xmlSubstituteEntitiesDefault (prevSubstValue);
xmlDoValidityCheckingDefaultValue = oldvalue;
+ xmlKeepBlanksDefault(oldvalue_keepblanks);
if (!docp)
RETURN_FALSE;
@@ -3615,6 +3622,7 @@
char *file;
int mode = 0, prevSubstValue;
int oldvalue = xmlDoValidityCheckingDefaultValue;
+ int oldvalue_keepblanks;
zval *errors = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|lz", &file, &file_len,
&mode, &errors) == FAILURE) {
@@ -3626,6 +3634,11 @@
array_init(errors);
}
+ if (mode & DOMXML_LOAD_DONT_KEEP_BLANKS)
+ oldvalue_keepblanks = xmlKeepBlanksDefault(0);
+ else
+ oldvalue_keepblanks = xmlKeepBlanksDefault(1);
+
if(mode & DOMXML_LOAD_SUBSTITUTE_ENTITIES)
prevSubstValue = xmlSubstituteEntitiesDefault (1);
else
@@ -3662,6 +3675,7 @@
}
xmlSubstituteEntitiesDefault (prevSubstValue);
xmlDoValidityCheckingDefaultValue = oldvalue;
+ xmlKeepBlanksDefault(oldvalue_keepblanks);
if (!docp) {
RETURN_FALSE;
Index: php4/ext/domxml/php_domxml.h
diff -u php4/ext/domxml/php_domxml.h:1.57 php4/ext/domxml/php_domxml.h:1.58
--- php4/ext/domxml/php_domxml.h:1.57 Thu Jun 13 05:05:56 2002
+++ php4/ext/domxml/php_domxml.h Thu Jun 13 06:47:19 2002
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_domxml.h,v 1.57 2002/06/13 09:05:56 chregu Exp $ */
+/* $Id: php_domxml.h,v 1.58 2002/06/13 10:47:19 chregu Exp $ */
#ifndef PHP_DOMXML_H
#define PHP_DOMXML_H
@@ -51,7 +51,7 @@
therefore it's easier for the script-programmers to check, what's working how
Can be checked with phpversion("domxml");
*/
-#define DOMXML_API_VERSION "20020607"
+#define DOMXML_API_VERSION "20020713"
extern zend_module_entry domxml_module_entry;
#define domxml_module_ptr &domxml_module_entry