Searching Is Actually Recursive : XML Element « XML « Python






Searching Is Actually Recursive

from xml.dom import minidom 
xmldoc = minidom.parse('binary.xml') 
reflist = xmldoc.getElementsByTagName('ref')      


firstref = reflist[0]                             
print firstref.toxml() 

plist = firstref.getElementsByTagName("p")        
plist = xmldoc.getElementsByTagName("p")          
plist 

plist[0].toxml()                                  

plist[1].toxml() 

plist[2].toxml()                                  

           
       








Related examples in the same category

1.Get element by name
2.Every Element Is Searchable
3.Searching for XML Elements