[XML-SIG] pyDOM NamedNodeMap - bug report and problem

Sean Mc Grath sean@digitome.com
Thu, 12 Aug 1999 15:26:21 +0100


I am trying to print out attribute name,value pairs using pyDOM and
having some problems. Here is the relevant part of my code:

for n in doc.documentElement.childNodes:
	if n.nodeType == core.ELEMENT_NODE:
		attrs = n.attributes
		for i in range (0,attrs.get_length()):
			attr = attrs.item(i)
			print attr.name
			print attr.value


The item() method initially did not work, returning an unsubscriptable object
error. This is a buglet in NamedNodeMap:

Before fix:
    # Additional methods specified in the DOM Recommendation
    def item(self, index):
        return self.data.values[ index ]

After fix: (parenthesis in call to values method of data dictionary)
    # Additional methods specified in the DOM Recommendation
    def item(self, index):
        return self.data.values()[ index ]

I am now getting my attribute names through just fine but all my attribute
values are None. There are definitely there in the DOM structure because
toxml puts 'em out just fine. Ideas?

regards,



<Sean URI="http://www.digitome.com/sean.html">
Developers Day Co-Chair, 9th International World Wide Web Conference
16-19, May, 2000, Amsterdam, The Netherlands http://www9.org
</Sean>