Let us start with an XML Document. Here is my XML Document saved to my computer as MyStudents.xml.
XMLParsing_0
Launch Python 3.7.0b5(x64bit) and do an import using the xml.etree.ElementTree module by importing it like,
XMLParsing_1
>>> import xml.etree.ElementTree as ET
Now you can use ET as shown here:
XMLParsing_2
Now you can get the 'root' of XML Document as in:
XMLParsing_3.jpg
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:
No comments:
Post a Comment