Commit caff9b87 authored by Christian Ledermann's avatar Christian Ledermann

default namespaces are nly supported by lxml

parent e3191e04
......@@ -117,7 +117,10 @@ class KML(object):
root = etree.Element('%skml' % self.ns)
root.set('xmlns', config.NS[1:-1])
else:
root = etree.Element('%skml' % self.ns, nsmap={None:self.ns[1:-1]})
if config.LXML:
root = etree.Element('%skml' % self.ns, nsmap={None:self.ns[1:-1]})
else:
root = etree.Element('%skml' % self.ns)
for feature in self.features():
root.append(feature.etree_element())
return root
......
......@@ -119,7 +119,7 @@ class BuildKmlTestCase(unittest.TestCase):
""" kml file without contents """
k = kml.KML()
self.assertEqual(len( list(k.features())),0)
if hasattr(etree, 'register_namespace'):
if config.LXML:
self.assertEqual( str(k.to_string())[:43],
'<kml xmlns="http://www.opengis.net/kml/2.2"/>'[:43])
else:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment