XML is just a tool that comes in many flavors and uses. XML excels at some things and sucks at others. I think one of the problems is that people have seen "enterprise" XML that is needlessly complex with namespaces and crap strewn around (SOAP, anyone?). The trick to designing XML formats for humans is adding real meaning to data while not making them overwhelming to read.
One of the things people take issue with is that XML sometimes chokes on some character or some missing bracket. There is, however, both an upside and a downside even to that. The upside is that you don't have ambiguity like you have with HTML where different cases of semi-invalid syntax can be interpreted differently.
The downside is that it's a bit harder to author and harder to learn. I agree there's an argument to be made that the web wouldn't have become to big so fast if HTML was as stringent as XML, but I'd also argue that we'd be glad if it did today. :)
Also, do not use it for everything just because you can, have the sense and judgement to apply it appropriately. If all you have is XML, you tend to always be an XSLT transformation away from what you want. :)
I'd argue that the format only really matters when humans need to interact with it. If you're writing some program that serializes something and sends it somewhere where it is to be consumed by another of your programs, who cares what it looks like so long as it's as efficient as possible? Use a binary format or bunnies and unicorns for all I care.
Pros of XML
- Covers a lot of edge cases that YAML and JSON don't
- There are excellent tools for parsing and validating XML in an array of different platforms and languages
- XML can easily and powerfully be transformed into another format (through things like XSLT)
- Reasonable XML documents are simple for humans to read and edit; don't tell me JSON is easier, it isn't :)
- XML is self-describing to some degree, i.e. it directly contains information about its structure and meaning (in contrast to most binary formats)
- Handles encoding
- Whitespace agnostic, which makes for easier cross-platform use
- Breaks if it isn't well-formed (Ensures data is structurally correct)
- It's not SGML
Cons
- Verbose
- It's not as fast to parse as binary
- Breaks if it isn't well-formed (crashes your application)
Good uses
- Configuration files
- Data interchange formats
- Version resilient file formats
- Storing documents in databases
Not so good uses
- Data transfer formats
- Serializing Objects
- Storing relational data in databases
- File format for high performance I/O scenarios