Powered by Ajaxy
Digg StumbleUpon LinkedIn YouTube Flickr Facebook Twitter RSS Reset

Python: How to Search for XML Elements

Python: How to Search for XML Elements
{filelink=16799}

from xml.dom import minidom 
def findElement(xml_file, elem):
    xmldoc = minidom.parse(xml_file)
    myElem = xmldoc.getElementsByTagName(elem)
    print myElem[0].toxml()
findElement('c:/teste.xml', 'addr')
findElement('c:/teste.xml', 'subjet')

Users who found this page were searching for:

  • python how to count occurrences in a list
  • CRC32 for a file in java

No comments yet.

Leave a Comment