1. Shlomi Fish
  2. perl-XML-LibXML

Commits

ph...@9ae0c189-cd1f-4510-a509-f4891f5cf20d  committed 8e7ba9b

Modified Files:
LibXML.xs LibXML.pm
parser inititialization sets now the defaults correctly - i hope.
updated the docs a bit

  • Participants
  • Parent commits 138acd5
  • Branches default

Comments (0)

Files changed (2)

File LibXML.pm

View file
  • Ignore whitespace
 get the resource either directly from the filesystem, or using an internal
 http client library.
 
+=head1 DEFAULT VALUES
+
+The following table gives an overview about the default values of the
+parser attributes.
+
+=over 4
+
+=item validation == off (0)
+
+=item expand_entities == on (1)
+
+=item keep_blanks == on (1)
+
+=item pedantic_parser == off (0)
+
+=item load_ext_dtd == on (1)
+
+=item complete_attributes == on (1)
+
+=item expand_xinclude == off (0)
+
+=back
+
+By default no callback handler is set.
+
 =head1 PARSING
 
 There are three ways to parse documents - as a string, as a Perl

File LibXML.xs

View file
  • Ignore whitespace
         }
 
         item = hv_fetch( real_obj, "XML_LIBXML_EXPAND_ENTITIES", 26, 0 );
-        if ( item != NULL && SvTRUE(*item) ) {
+        if ( item != NULL ) {
+            if ( SvTRUE(*item) ) {
+                xmlSubstituteEntitiesDefaultValue = 1;
+                xmlLoadExtDtdDefaultValue |= XML_DETECT_IDS;
+            }
+            else {
+                xmlSubstituteEntitiesDefaultValue = 0;
+            }
+        }
+        else {
             xmlSubstituteEntitiesDefaultValue = 1;
             xmlLoadExtDtdDefaultValue |= XML_DETECT_IDS;
         }
+
+        item = hv_fetch( real_obj, "XML_LIBXML_KEEP_BLANKS", 22, 0 );
+        if ( item != NULL ) {
+            if ( SvTRUE(*item) )
+                xmlKeepBlanksDefault(1);
+            else {
+                xmlKeepBlanksDefault(0);
+            }
+        }
         else {
-            xmlSubstituteEntitiesDefaultValue = 0;
-        }
-
-        item = hv_fetch( real_obj, "XML_LIBXML_KEEP_BLANKS", 22, 0 );
-        if ( item != NULL && SvTRUE(*item) )
-             xmlKeepBlanksDefault(1);
-        else {
-             xmlKeepBlanksDefault(0);
-        }
+            /* keep blanks on default */
+            xmlKeepBlanksDefault(1);
+        }
+
         item = hv_fetch( real_obj, "XML_LIBXML_PEDANTIC", 19, 0 );
         xmlPedanticParserDefaultValue = item != NULL && SvTRUE(*item) ? 1 : 0;
 
             xmlLoadExtDtdDefaultValue ^= 1;
 
         item = hv_fetch( real_obj, "XML_LIBXML_COMPLETE_ATTR", 24, 0 );
-        if (item != NULL && SvTRUE(*item))
+        if (item != NULL && SvTRUE(*item)) {
             xmlLoadExtDtdDefaultValue |= XML_COMPLETE_ATTRS;
-        else
+        }
+        else {
             xmlLoadExtDtdDefaultValue ^= XML_COMPLETE_ATTRS;
+        }
         /* now fetch the callbacks */
 
         item = hv_fetch( real_obj, "XML_LIBXML_READ_CB", 18, 0 );
                                         cls = PmmNodeTypeName( tnode );
                                         element = sv_setref_pv( element,
                                                                 (const char *)cls,
-                                                                (void *)newns
+                                                                (void*)newns
                                                           );
                                     }
                                     else {
         node = PmmSvNode(pnode);
         ns = node->nsDef;
         while ( ns != NULL ) {
-            newns = xmlCopyNamespace((xmlNsPtr)ns);
+            newns = xmlCopyNamespace(ns);
             if ( newns != NULL ) {
                 element = NEWSV(0,0);
                 element = sv_setref_pv( element,