What are the best practices for versioning XML schemas?

This is such a difficult subject that it’s not even funny, and one that I have spent years providing consultancy support for.

There are many best practices out there, but a most of them do not work in all situations. For example, many advocate the use of “xsd:any” to allow extensions, and that is just a recipe for disaster if developers are in charge of maintaining the schema, turning it into a dump.

Here are some tips for you if you’re getting started:

  • Do not put a minor version number, micro version number, date, or anything else of the sort, into your namespace. Every time you change the namespace, you will break all processing applications.
  • Do put a “version” attribute in the XML instance document. That will enable a processing application or a version adapter service to figure out what it is processing.
  • Do specify a policy of what constitutes a backwards compatible change, for example: adding optional elements will not break senders, and will not break receivers either if they use a policy of ignoring elements they do not know (JAXB and XMLBeans can be configured this way)

Dood luck!

Leave a Comment