Bryan Martin
1 min readSep 27, 2021

--

I don't hate XML, but I prefer JSON for most of my development. My biggest problems with XML has been the following.

1. Namespaces and namespace collision handling

2. It doesn't require a text delimiter for strings. This often means that you have to include escape codes so that the content doesn't interfere with reserved characters like '<' '>' and '&'. You can use CDATA tags....but...meh.

3. Many older XML documents were produced before serialization/deserialization was popular. The format of those document were horrible. Trying to map those documents to a class...pain. That's not XML's fault though.

4. XML doesn't have semantics . For example, XML doesn't have a of way expressing an array. The schema or DTD is the only place were you can specify that a certain element is an array of things. This means you have to look at two documents in order to understand what is an array and what's not an array. XML is more flexible in this regard. You can use to define other markup languages. However, most the time you don't need this kind of flexibility and JSON has the inherent semantics of the JavaScript objects which make it trivial to parse and better suited to swapping data between browsers and webservers.

--

--

No responses yet