]> granicus.if.org Git - php/commitdiff
- Added DOMXML_LOAD_DONT_KEEP_BLANKS as possible mode, if one wants really nicely
authorChristian Stocker <chregu@php.net>
Thu, 13 Jun 2002 10:47:19 +0000 (10:47 +0000)
committerChristian Stocker <chregu@php.net>
Thu, 13 Jun 2002 10:47:19 +0000 (10:47 +0000)
  formatted XML-Documents (but this can have sideeffects, if you depend on whitespaces..)
- bumped up domxml-api-version number.

ext/domxml/php_domxml.c
ext/domxml/php_domxml.h

index 30bf0ef895e2ab08b449301c3f62b8ca8ea4fa80..ddcf88baaf2f76b3100219f8aa6098f53ccb6756 100644 (file)
 #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 @@ PHP_MINIT_FUNCTION(domxml)
        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 @@ PHP_FUNCTION(xmldoc)
        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 @@ PHP_FUNCTION(xmldoc)
                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 @@ PHP_FUNCTION(xmldoc)
        }
        xmlSubstituteEntitiesDefault (prevSubstValue);
        xmlDoValidityCheckingDefaultValue = oldvalue;
+       xmlKeepBlanksDefault(oldvalue_keepblanks);
 
        if (!docp)
                RETURN_FALSE;
@@ -3615,6 +3622,7 @@ PHP_FUNCTION(xmldocfile)
        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 @@ PHP_FUNCTION(xmldocfile)
                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 @@ PHP_FUNCTION(xmldocfile)
        }
        xmlSubstituteEntitiesDefault (prevSubstValue);
        xmlDoValidityCheckingDefaultValue = oldvalue;
+       xmlKeepBlanksDefault(oldvalue_keepblanks);
 
        if (!docp) {
                RETURN_FALSE;
index 22432fb4f5b2f54fdd7e3e118612f1ce6359e279..4b01362890b8434372df4d74832b681dec7c5922 100644 (file)
@@ -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