In theory XML allows two parties to agree on an unambiguous definition of a format for data exchange. Low level rules define what is and what is not XML. Optional layers on top of that define some sort of schema for the elements in the XML document and once again it is relatively easy to take an XML document and confirm whether or not it complies with the agreed schema.
In practise things are quite different to theory.
In my experience, there's always politics. There's always one party which is either unwilling or unable to comply with the rules or in extreme cases even acknowledge that rules exist. The other party inevitably has to bend over and take it. This has led me to postulate the following 'law':
Where XML data must be exchanged between two parties, the party at the "Perl end" of the pipe will inevitably have to adapt to whatever non-compliant tag-soup gunk the other party emits or expects.