From: Tony Mack Date: Thu, 27 Oct 2011 15:45:08 +0000 (-0400) Subject: set default namespace to a dummy vvalue if the xml nsmap is empty X-Git-Tag: sfa-1.1-1~6^2~3 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=bdf8dd800494b4c336e391bd0127b000b077b7aa;hp=1f1feb6d4914fe0745f61b8e0c90127c15d06069;p=sfa.git set default namespace to a dummy vvalue if the xml nsmap is empty --- diff --git a/sfa/util/xml.py b/sfa/util/xml.py index 06d61c9c..78e4c6a2 100755 --- a/sfa/util/xml.py +++ b/sfa/util/xml.py @@ -55,14 +55,13 @@ class XML: # set namespaces map self.namespaces = dict(self.root.nsmap) if 'default' not in self.namespaces and None in self.namespaces: + # If the 'None' exist, then it's pointing to the default namespace. This makes + # it hard for us to write xpath queries for the default naemspace because lxml + # wont understand a None prefix. We will just associate the default namespeace + # with a key named 'default'. self.namespaces['default'] = self.namespaces[None] - # If the 'None' exist, then it's pointing to the default namespace. This makes - # it hard for us to write xpath queries for the default naemspace because lxml - # wont understand a None prefix. We will just associate the default namespeace - # with a key named 'default'. - if None in self.namespaces: - default_namespace = self.namespaces.pop(None) - self.namespaces['default'] = default_namespace + else: + self.namespaces['default'] = 'default' # set schema for key in self.root.attrib.keys():