samedi 9 mai 2015

iterating through all xml elements python

I have just started out using python (3+) and am trying to figure out how to extract all the elements from an XML file inc all the child nodes (so grand children and great grand children nodes etc if that makes sense) without doing a check after extracting every child. I cannot hardcode, as the xml file may change. I simply would like to extract the element, its parent element and if it has any children.

Any advice/help would be greatly appreciated.

Cap.

Aucun commentaire:

Enregistrer un commentaire