Python: Reading XML data using DOM parser

A simple and effective way to read a xml using the DOM parser in python is shown below:
Sample example XML:

Hello World.

Python program to print the XML:


#import the dom from the xml folder.
from xml.dom import minidom
xmldoc = minidom.parse(Greeting.xml)
#print the xml in the command prompt
print xmldoc.toxml()

In

Leave a Reply

Your email address will not be published. Required fields are marked *