By reading StackOverflow and listening to the Joel Spolsky and Jeff Atwood podcasts, I am starting to believe that many developers hate using XML, or at least try to avoid using XML as much as possible for storing or exchanging data .
On the other hand, I really enjoy using XML for several reasons:
- XML serialization is implemented in most modern languages and is extremely easy to use ,
- Being slower than binary serialization, XML serialization is very useful when it comes to using the same data from several programming languages , or where it is intended to be read and understood, even for debugging, of a person (JSON, for example, is more difficult to understand),
- XML supports unicode , and when used correctly, problems with different encodings, characters, etc. not.
- There are many tools that simplify working with XML data. XSLT is an example that facilitates the presentation and transformation of data. XPath is another way to make finding data easier.
- XML can be stored on some SQL servers, which allows scenarios when data that is too complex to be easily stored in SQL tables must be stored and processed; For example, JSON or binary data cannot be manipulated directly by SQL (except for manipulating strings, which are crazy in most cases),
- XML does not require the installation of any applications. If I want my application to use a database, I must first install the database server. If I want my application to use XML, I don’t have to install anything ,
- XML is much more explicit and extensible than, for example, Windows Registry or INI files,
- In most cases, there is no CR-LF problem , due to the level of abstraction provided by XML.
So, taking into account all the benefits of using XML, why do many developers hate using it? IMHO, the only problem is that:
- XML is too verbose and requires much more space than most other forms of data, especially when it comes to Base64 encoding.
Of course, there are many scenarios in which XML is not suitable at all. Storing SO questions and answers in an XML file on the server side will be completely wrong. Or, when you are storing AVI videos or a bunch of JPG images, it is best to use XML.
But what about other scenarios? What are the disadvantages of XML?
For people who thought this question was not a real question:
Unlike questions like the unoccupied significant new inventions in the field of computing since 1980 , my question is a very clear question and clearly offers to explain what weaknesses other people experience using XML and why they don't like them. He does not invite discussion, for example, if XML is good or bad. It also does not require extensive discussion; thus, the current answers received so far are short and accurate and provide sufficient information that I wanted.
But this is a wiki, since there cannot be a unique good answer to this question.
According to SO, “not a real question” is a question where “It's hard to say what is being asked here. This question is ambiguous, vague, incomplete or rhetorical and cannot be reasonably responded to in its current form.”
- What is being asked here: I think the question itself is very clear, and a few paragraphs above the text make it even more clear,
- This question is ambiguous, vague, incomplete: again, there is nothing ambiguous, neither vague nor incomplete,
- or rhetorical: this is not so: the answer to my question is not something obvious,
- and cannot be reasonably answered: several people have already given great answers to the question, showing that the question can be answered reasonably.
It also seems quite obvious how to evaluate responses and determine the accepted answer. If the answer provides good reasons for what is wrong with XML, there is a chance that this answer will be voted and then accepted.
xml xml-serialization data-storage
Arseni mourzenko
source share