xml parsing - Python: get all content of specific XML tags -
i have parsed xml file , need content <name>
tags.
so far i've come this:
xml_tag = dom.getelementsbytagname('person')[0].toxml() xml_data = xml_tag.replace('<name>','').replace('</name>','')
this gets first tag. how create list of name tags content in it?
usually use lxml these things looking @ code, or somethin similar should work.
xml_tag = dom.getelementsbytagname('person')[0] xml_data = [elem.nodevalue elem in dom.getelementsbytagname('name')]