XML or extensible markup language was designed to store and transport data. It simplifies data sharing, data transport, platform flexibility, and data availability. Just like all markup languages, it uses tags. However, unlike other markup languages like HTML, XML doesn’t have a specific list of tags. Additionally, XML doesn’t carry data about how the information will be displayed like HTML. It focuses on how the data will be stored, searched, and shared. It enables sharing of structured information among programs and people.
Because XML has strict validation, it is reliably used by other programs and is often used for web content. Since everything is structurally correct, XML documents can easily be parsed by other programs for output. You can use it to structure everything like a book for example.
<book>
<title> Learn XML </title>
<author> Enhance and go </author>
</book>
As you can see above, it includes details about the book and organizes it. It’s as simple as adding tags of your choosing like <author> and closing it with </author> with the author name between the opening and closing tag. Tags are case sensitive unlike HTML so ensure tags match.
Computer can sort and categorize XML files more efficiently than any other document and it’s a great way to store data consistently across multiple platforms while ensuring data accuracy.
Both XML and JSON is a way to transfer data. XML is a text based structure and JSON is a object based structure. The biggest difference is the size of it all. XML requires tags (opening and closing), so you’ll see <name>bob</name>. Compare this to JSON format which can do the same thing but lighter, “name”:”bob”. JSON doesn’t need the ending tag unlike XML. Not to mention XML is lot more harder to organize and creates more errors when compared to JSON. Not to mention JSON can easily be parsed with javascript while XML you need to declare and bring it.