Sharing structured data

XML Magazine

Subscribe to XML Magazine: eMailAlertsEmail Alerts newslettersWeekly Newsletters
Get XML Magazine: homepageHomepage mobileMobile rssRSS facebookFacebook twitterTwitter linkedinLinkedIn

XML Authors: Jnan Dash, Jayaram Krishnaswamy, Jason Bloomberg, Chris Pollach, Peter Silva

Related Topics: Intel XML, XML Magazine

Blog Feed Post

Parsing XML with Python 3.7

Let us start with an XML Document. Here is my XML Document saved to my computer as MyStudents.xml.


Launch Python 3.7.0b5(x64bit) and do an import using the xml.etree.ElementTree module by importing it like,


>>> import xml.etree.ElementTree as ET

Now you can use ET as shown here:


Now you can get the 'root' of XML Document as in:


You use the tag attribute of the root to get the tag.

The 'root' has children which are the four students with their ID's.

You can get all of the children as shown in the code shown below.

How is XML Documents parsed in R?
Read here.

Also here.

Parsing using JSON:

Read the original blog entry...

More Stories By Jayaram Krishnaswamy

Jayaram Krishnaswamy is a technical writer, mostly writing articles that are related to the web and databases. He is the author of SQL Server Integration Services published by Packt Publishers in the UK. His book, 'Learn SQL Server Reporting Services 2008' was also published by Packt Publishers Inc, Birmingham. 3. "Microsoft SQL Azure Enterprise Application Development" (Dec 2010) was published by Packt Publishing Inc. 4. "Microsoft Visual Studio LightSwitch Business Application Development [Paperback] "(2011) was published by Packt Publishing Inc. 5. "Learning SQL Server Reporting Services 2012 [Paperback]" (June 2013) was Published by Packt Publishing Inc. Visit his blogs at: He writes articles on several topics to many sites.