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')] 

Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -