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

scoder at codespeak.net scoder at codespeak.net
Tue May 15 16:56:12 CEST 2007


Author: scoder
Date: Tue May 15 16:56:11 2007
New Revision: 43410

Modified:
   lxml/trunk/CHANGES.txt
   lxml/trunk/src/lxml/etree.pyx
   lxml/trunk/src/lxml/objectify.pyx
Log:
empty (non-None) string prefixes handled as None instead of empty string

Modified: lxml/trunk/CHANGES.txt
==============================================================================
--- lxml/trunk/CHANGES.txt	(original)
+++ lxml/trunk/CHANGES.txt	Tue May 15 16:56:11 2007
@@ -44,6 +44,8 @@
 Bugs fixed
 ----------
 
+* passing '' as namespace prefix in nsmap could be passed through to libxml2
+
 * Objectify couldn't handle prefixed XSD type names in ``xsi:type``
 
 * More ET compatible behaviour when writing out XML declarations or not

Modified: lxml/trunk/src/lxml/etree.pyx
==============================================================================
--- lxml/trunk/src/lxml/etree.pyx	(original)
+++ lxml/trunk/src/lxml/etree.pyx	Tue May 15 16:56:11 2007
@@ -355,7 +355,7 @@
         for prefix, href in nsmap.items():
             href_utf = _utf8(href)
             c_href = _cstr(href_utf)
-            if prefix is not None:
+            if prefix is not None and prefix:
                 prefix_utf = _utf8(prefix)
                 c_prefix = _cstr(prefix_utf)
             else:

Modified: lxml/trunk/src/lxml/objectify.pyx
==============================================================================
--- lxml/trunk/src/lxml/objectify.pyx	(original)
+++ lxml/trunk/src/lxml/objectify.pyx	Tue May 15 16:56:11 2007
@@ -1768,7 +1768,8 @@
             name = _xsi
             for p, ns in nsmap.items():
                 if ns == XML_SCHEMA_NS:
-                    _xsi = prefix + ':' + _xsi
+                    if p is not None and P:
+                        _xsi = prefix + ':' + _xsi
                     break
             else:
                 raise TypeError, "XSD types require the XSD namespace"


More information about the lxml-checkins mailing list