The software that writes an XML document is often written by the same developer who writes the software which reads it. The structure of the XML elements seems obvious. The need for a formal specification might not be felt at all.
As software development proceeds, the data usually becomes more complex and the project often involves more developers. Client software and server software become mismatched as they reflect different stages in the evolution of the data design.
This problem is common when a project starts without planning the data communications. Thoughtful data design is a good investment. It requires a serious commitment of time, but it pays off in stable XML formats. This stability frees the developers of the client and server application from a hobbling dependence.
An XML server must provide the elements the client requires in the expected format. Otherwise, dysfunction is inevitable: the client fails to get necessary information or the server sends signals that the client ignores.
XML is famously resilient. Many miscommunications will still work ”more or less. But this level of function can easily cause bugs. These bugs will be more subtle and more difficult to identify than a frank data load error.
The solution is to describe the data structure independently of the file. We create a link in the XML file to a reference file. The reference file describes the XML structure unambiguously. Programmers experienced in languages like C++ will be very familiar with this concept. In such languages, prototypes of the objects in the applications are placed in a shared header file. This ensures agreement between all the source files on their structure.
By placing these shared definitions in a common file, several wins are achieved. Maintenance is simplified and features are simple to publish. Collisions are averted. Best of all, the compiler ”not sloppy humans ”automatically enforces compliance with agreed-upon standards.
The solution is very similar in XML. Authors of XML data structures publish their design assumptions in an external file to which compliant data files refer. It is enforced by the XML parser.