Discussion summary

Discussions about XML's complexity and usage, with some users preferring alternatives like JSON or HTML5. Opinions vary from neutral to mildly negative, citing verbosity and difficulty.

What the discussion says

  • XML is often overly complex due to poor implementation.
  • Some users prefer JSON for its simplicity.
  • HTML5 introduced features that XML could adopt.
  • XSLT and nested XML structures are seen as cumbersome.
  • A few see XML's resurgence akin to vinyl revival.
“XML is ok, the problem is how some people use it.”
— atoav
“XML is verbose and often unnecessarily complex.”
— hackrmn

Join the discussion

Write your take first — we'll ask for email only when you're ready to publish.

  • Hacker News
  • Last year we chose XML as the basis for our document language.

    It's been a good choice for designing a new language, but we've been really surprised by the poor quality of the available parsers. We figured it would be a solved problem, but we'll be writing our own at some point.

  • I dislike it because it failed in such a fundamental way as a way to represent a document; you cannot, in general, reliably determine what characters the bytes in an XML file represent - the best a general XML processor can do is guess.
  • I’ve hated XML since 2004. The worst part about it is the tags vs attributes fights. They both do the same thing and the only difference is preference. Having two ways of doing the same thing invite and incite religious positions and cause unnecessary fighting. There should be one, opinionated way of doing things so you avoid confusion.
  • XML is unfairly maligned. Yes, people bought into it too much 26 years ago, but then you would too if you had to maintain someone else's massive packed struct dumped into a file and documented in a poorly-maintained word document --- or worse, a brace of dumb IETF RFCs that contradict eachother.

    I am glad that younger generations are looking at it with fresh eyes. XML is a useful format; it has its place in your toolbox. Ignore the haters.

  • At least XML is hated for the wrong reasons (e.g. verbosity, esthetics) most of the time. There was for sure an era where it was overused (see Apache Cocoon from 2006 https://en.wikipedia.org/wiki/Apache_Cocoon). But XML is still a pretty good format to exchange (and store) data and make sure the data conforms to a certain schema. JSON Schema in comparison is not nearly as powerful.
  • My reasons to hate XML:

    - element vs attribute ambiguity

    - model of the document does not fit nicely to programming model of structs, dicts and arrays

    - too many complexities (entities, cdata, parser directives)

    - cardinality unknown without schema (is that a single value, or an array that just happens to have one element)

    - order of elements may or may not be significant depending on schema

    - not really extensible if the original schema does not explicitly allow for extensibility

    - some types of valid XML documents are not representable by a schema (e.g. any number of different elements in any order)

    - verbosity

    - namespace identifiers being URIs that may or may not be resolvable

    What I want for general data exchange is JSON with comments and sane namespaces.

    Edit: line wraps

  • XML was a good, well-intentioned idea.

    The problem, IMHO, was that rampant "xml-abuse" in the naughts. ws-* standards and over-engineered garbage like SOAP ("complex object access protocol") made people loathe XML.

    I did like JAXB in Java, XLST, schemas, XPATH. Never got into XSL, but it seemed like good thing too. It worked best when your tooling manipulated it for you or at least helped you in an intelligent way. Much of the hate for XML came from situations where you had to deal with someone's over-the-top-one-size-fits all schema without the benefit of tooling to at least hint you in the right direction.

    It still survives in WPF and c# *.proj files. If it were just me, I would still use it for object serialization. But json is king now even though it's inferior.

  • In my opinion, the reason people hate XML is because of what M signifies: it is a markup language and most of the time we don’t need a markup language. Markup languages are great for rich text documents. They are just not a good fit for representing data. The markup-nature of XML introduces unnecessary choice in whether to use an attribute or a child element to represent data; for HTML such ambiguity doesn’t actually exist but for data it does. Consider this piece of XML from the Python docs:

        <country name="Liechtenstein">
            <rank>1</rank>
            <year>2008</year>
            <gdppc>141100</gdppc>
            <neighbor name="Austria" direction="E"/>
            <neighbor name="Switzerland" direction="W"/>
        </country>
    
    Why is the country name an attribute but not the rank? Why are all information about neighbors attributes but not children?

    Furthermore parsing JSON or YAML gives you an AST that consists of the basic data types like lists and dictionaries. Parsing XML gives you an AST that requires a lot more effort to turn into data in your domain. Even on the web, very few people like to use the verbose XML DOM API like childNodes, nodeType, getElementsByTagName et al; it is basically unheard of for anyone to use it outside the web such as in Python, despite that the DOM API is in the Python standard library since forever (see https://github.com/python/cpython/blob/3.14/Lib/xml/dom/mini... for example).

Explore Birbla archives