[XML-SIG] Improvement pulldom and minidom

Stephan Tolksdorf andorxor@gmx.de
Fri, 27 Oct 2000 19:40:52 +0200


I would like to have the two methods hasAttribute and hasAttributeNS
of DOM2's Element in minidom included.
They are very easy to implement and rather usefull:

class Element:
    def hasAttribute(self, name):
        return self._attrs.has_key(name)
    def hasAttributeNS(self, namespaceURI, localName):
        return self._attrsNS.has_key((namespaceURI, localName))

Additonally I propose to replace

l. 220 in pulldom.py (def parse):
                if type(stream_or_string) is type(""):
          with: if type(stream_or_string in [type(""), type(u'')]:

like it is done in saxutils.prepare_input_source. Just to make it possible
to pass unicode filenames directly to the function.

Best regards,
  Stephan Tolksdorf