How XML works

If you look at an XML document, you may think that it's similar to HTML documents, because both of them have tags. But no, HTML documents follow a certain set of rules defined by the language. In the case of XML, the rules are defined by the document itself, as in the following example:

<?xml version="1.0" encoding="UTF-8"?> 
<animals> 
<fish> 
<name>Discus</name> 
<location>Brasil/location> 
<danger_extintion="1">Shot the web</danger_extintion> 
</fish> 
</animals> 

You can see that the document itself defined each tag and how to use it, along with the values, and so on. This is the reason why applications such as MS Office use XML to manage their documents in the background.

For example, let's look at a Word document:

<?xml version="1.0" ...

Get Bug Bounty Hunting Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.