Introduce yourself to XML before Maggi cooks.

DISCLAIMER: I don’t work for nestle nor are they paying any royalty for this post. Although it would be nice if they gifted a carton of Kitkats. :p
Before we begin, take heated water in a pan, plop the noodles, fire. (By the end of the article you’ll have something that suits your savour).
First Things first
<?xml version=”1.0" encoding=”UTF-8"?>.
This line speaks for it itself. version and encoding are the “attributes” of the xml “tag”. This element must be the first thing on the first line. This is analogous to she-bang(yes, like she-bang this is optional).
Tags, attributes, elements

Opening tag: <tag-name>
Closing tag: </tag-name>
Open-close tag: <tag-name />
- It’s mandatory to close them in the reverse order they were opened.
- They can be nested.(author, year, price and title are nested inside book tag. which in-turn belongs to bookstore tag)
- Whatever goes between the Open and Close tag are the elements of the tag.(e.g 2003 is the element of year tag)
- key-value element pairs(written key=”value”) are given along the tag. They are known as “attributes” and the values of the attribute must be quoted.(e.g: lang=”en” is the attribute of title.)Note: attributes can’t be nested.
- Tag-names are case-sensitive and can only contain alphanumeric chars and underscore.(The first character must be an alphabet).
- <!--whatever goes in here is a comment.-->(see line 2)
- Reserved characters are escaped using “&;”. < escapes lesser than.
- XML reserves no tag-names that means you can come up with any name you want and get-away with it.
That’s all you need to know to read an XML document. The rules for XML is similar to HTML but only stricter. The attitude XML has is “I don’t care about the presentation, give me the contents”.
References
There are things I left out you can refer one of the links(below) for more info.
- Wikipedia
- XML Tutorial
- Have your XML validated here.
Consider the alternatives
- JSON — popular and “fat free alternative to XML”(recommended by many)
- Turtle — not so popular and recommended by a stranger on reddit
- YAML
- Wikipedia article
It’s time for masala and stirring. Thanks for reading and enjoy your Maggi.
P.S: The title for the story is inspired by all the posts which introduce you to some framework/language in Y minutes(where Y= the time it takes to read the post as guess by Medium).
