Is XML human-readable?
I've read it in many tutorials, articles, and blog posts: "XML is not human-readable". It is supposedly full of useless information making it hard to type, hard to read, and hard to understand. This is supposed to explain why one should favor JSON over XML and templating engines over XSLT.
I wouldn't know what tools one should use for their jobs, therefore I cannot help in that regard, but it is simply not true that XML is not human-readable. Code is, of course, readable. It is usually designed to be readable and in the case of XML it does its job quite well. Here is why I think so: XML is about the structure, not the contents, of a document; XML is developer-friendly and developers are humans. Therefore, XML is human-readable.
XML is about the structure. It was never designed for the end-user to read, but for developers. It was not designed for you to read the content, but the structure. It showcases semantic tags, something modern web development pursues with web components. If these tags are useless, as many claims, it is either because they are not semantic or because the reader is not interested in the structure.
XML is developer-friendly. It is quite easy to write XML code. Features present in many - if not all - code editors allow for autocompletion, folding, and auto-closing.
The closing tags clearly identify the limits of the structure for the developer. Given their semantics, the developer can easily identify what he is reading without the need to constantly seek the match. Consider the following piece of code, for example:
} } } }, "color": "blue" }
That is way harder to understand than this:
</value> </currency> </price> <color>blue</color> </product>
It is true that XML has repeated information but for someone interested in the structure of an entity, the repetition that makes it readable. One could also argue that if I had included the rest of the document, the first snippet would have been clearer. But that is the point. With XML if I am coding the structure of an entity I can easily understand the context I am in. This feature allows me, for example, to collapse (using a common feature of text editors) the tag above if I am not interested in it.
The semantic tags on both sides help the developer quickly read the structure he is interested in.
Developers are humans. JSON surely amounts to less bandwidth and disk space, but these are not human-readable features. On the contrary, it is mostly the removal of human reading aid that makes JSON files smaller.
Disclaimer
I'm not telling anyone not to use JSON. Why would I do that? Go ahead. Use JSON, YAML, and our good old CSV. I'm sure I will. And I'll also use XML. I'm just too old to have strong opinions.
I love the nuance. Keep up the good work.