kakada wrote:
> Hello all,
> 
> Could anyone help me by giving example of getAttribute
> 
> xmldata = ziparchive.read("content.xml")
> xmldoc = minidom.parseString(xmldata)
> officeNode = xmldoc.getElementsByTagName('office:text')
> 
> I have another function:
> def go_thru (nodelist):
>     for x in range(nodelist.length):
>         node = nodelist[x]
>         i = 0
>         print node.getAttribute('text:style-name')
> 
> go_thru(officeNode) #Calling function
> 
> I always get error message: AttributeError: Text instance has no
> attribute 'getAttribute'
> Could anyone give an explanation?

I think it should be node.attributes['text:style-name'].nodeValue.

You might want to look at ElementTree, it is a more Pythonic XML library.

Kent

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to