Sunday, 17 August 2014

Parsing xml/svg



Why is this not printing all the paths only the first instance/tag


from xml.dom import minidom



def converter():
xmldoc= minidom.parse("file.svg")
a=xmldoc.getElementsByTagName("svg")[0]
b=a.getElementsByTagName("g")[0]
pth=b.getElementsByTagName("path")

for p in pth:
a = p.getAttribute('class')
b = p.getAttribute('d')

return a , b

No comments:

Post a Comment