Jason Pellerin  committed be2a545

Fixed handling of attributes with namespaces

  • Participants
  • Parent commits 585dc41

Comments (0)

Files changed (1)

File scio/

                 kids = set( for child in self._children)
                 kids_subs = self._child_substitutions()
                 content = element.text
+                tagns = ns(element.tag)
                 for attr, aval in element.attrib.items():
-                    if attr != local(attr):
+                    # check instead that any attr ns matches
+                    # element ns (or that it is local)
+                    if ns(attr) not in set([None, tagns]):
-                    if self.any_attribute and attr not in attrs:
-                        self._attributes.append(AnyAttribute(attr))
-                    setattr(self, attr, aval)
+                    aname = local(attr)
+                    if self.any_attribute and aname not in attrs:
+                        self._attributes.append(AnyAttribute(aname))
+                    setattr(self, aname, aval)
                 for el in element:
                     if el.text is not None or el.attrib or len(el):
                         name = local(el.tag)