X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sfa%2Futil%2Fxml.py;h=e79fd472d9614ab35aadf641432698e7f51ad16e;hb=0a47c681b8a135872991363950f598c865cb5286;hp=91a1d9509c1e9311213b183e7b1b878169fb9946;hpb=ea9c62aa2e289e64a2bd3a8075ed45a97792f697;p=sfa.git diff --git a/sfa/util/xml.py b/sfa/util/xml.py index 91a1d950..e79fd472 100755 --- a/sfa/util/xml.py +++ b/sfa/util/xml.py @@ -56,6 +56,8 @@ class XML: self.root = tree.getroot() # set namespaces map self.namespaces = dict(self.root.nsmap) + if 'default' not in self.namespaces and None in self.namespaces: + 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 @@ -200,7 +202,7 @@ class XML: return self.toxml() def toxml(self): - return etree.tostring(self.root, pretty_print=True) + return etree.tostring(self.root, encoding='UTF-8', pretty_print=True) def todict(self, elem=None): if elem is None: