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

Php - Delimiter must not be alphanumeric or backslash -

c# - How to change the "Applies To" field under folder auditing options programatically (.NET) -

c++ - Ambiguity when using boost::assign::list_of to construct a std::vector -