[Lxml-checkins] r52951 - in lxml/trunk: . src/lxml

scoder at codespeak.net scoder at codespeak.net
Wed Mar 26 00:18:06 CET 2008


Author: scoder
Date: Wed Mar 26 00:18:04 2008
New Revision: 52951

Modified:
   lxml/trunk/   (props changed)
   lxml/trunk/src/lxml/iterparse.pxi
   lxml/trunk/src/lxml/saxparser.pxi
Log:
 r3828 at delle:  sbehnel | 2008-03-25 22:30:28 +0100
 cleanup


Modified: lxml/trunk/src/lxml/iterparse.pxi
==============================================================================
--- lxml/trunk/src/lxml/iterparse.pxi	(original)
+++ lxml/trunk/src/lxml/iterparse.pxi	Wed Mar 26 00:18:04 2008
@@ -325,6 +325,8 @@
       - remove_blank_text  - discard blank text nodes
       - remove_comments    - discard comments
       - remove_pis         - discard processing instructions
+      - compact            - safe memory for short text content (default: True)
+      - resolve_entities   - replace entities by their text value (default: True)
 
     Other keyword arguments:
       - encoding           - override the document encoding
@@ -337,7 +339,8 @@
     def __init__(self, source, events=("end",), *, tag=None,
                  attribute_defaults=False, dtd_validation=False,
                  load_dtd=False, no_network=True, remove_blank_text=False,
-                 remove_comments=False, remove_pis=False, encoding=None,
+                 compact=True, resolve_entities=True, remove_comments=False,
+                 remove_pis=False, encoding=None,
                  html=False, XMLSchema schema=None):
         cdef _IterparseContext context
         cdef char* c_encoding
@@ -366,10 +369,14 @@
         if attribute_defaults:
             parse_options = parse_options | xmlparser.XML_PARSE_DTDATTR | \
                             xmlparser.XML_PARSE_DTDLOAD
-        if not no_network:
-            parse_options = parse_options ^ xmlparser.XML_PARSE_NONET
         if remove_blank_text:
             parse_options = parse_options | xmlparser.XML_PARSE_NOBLANKS
+        if not no_network:
+            parse_options = parse_options ^ xmlparser.XML_PARSE_NONET
+        if not compact:
+            parse_options = parse_options ^ xmlparser.XML_PARSE_COMPACT
+        if not resolve_entities:
+            parse_options = parse_options ^ xmlparser.XML_PARSE_NOENT
 
         _BaseParser.__init__(self, parse_options, html, schema,
                              remove_comments, remove_pis,

Modified: lxml/trunk/src/lxml/saxparser.pxi
==============================================================================
--- lxml/trunk/src/lxml/saxparser.pxi	(original)
+++ lxml/trunk/src/lxml/saxparser.pxi	Wed Mar 26 00:18:04 2008
@@ -141,7 +141,7 @@
                         c_attributes[3], c_attributes[4] - c_attributes[3],
                         "strict")
                 python.PyDict_SetItem(attrib, name, value)
-                c_attributes = c_attributes + 5
+                c_attributes += 5
         if c_nb_namespaces == 0:
             nsmap = EMPTY_READ_ONLY_DICT
         else:
@@ -153,7 +153,7 @@
                     prefix = funicode(c_namespaces[0])
                 python.PyDict_SetItem(
                     nsmap, prefix, funicode(c_namespaces[1]))
-                c_namespaces = c_namespaces + 2
+                c_namespaces += 2
         element = context._target._handleSaxStart(tag, attrib, nsmap)
         if element is not None and c_ctxt.input is not NULL:
             if c_ctxt.input.line < 65535:


More information about the lxml-checkins mailing list