bug: defaultNamespace detection fails on XML-attributes when deserializing
jkowalleck opened this issue · comments
and this one was completely unable to detect the defaultNS, and assumed it was '' -- which is the identifier for the defaultNS not the defaultNS itself ...
and then the NameSpace-detection on XML-attributes fails ...
working patch:
serializable/serializable/__init__.py
Lines 455 to 462 in 9bc4abc
if default_namespace is None:
_namespaces = dict([node for _, node in
SafeElementTree.iterparse(StringIO(SafeElementTree.tostring(data, 'unicode')),
events=['start-ns'])])
- if 'ns0' in _namespaces:
- default_namespace = _namespaces['ns0']
- else:
- default_namespace = ''
+ default_namespace = (re.compile(r'^\{(.+?)\}.').search(data.tag) or (None,_namespaces.get('')))[1]