What are the best practices for versioning XML schemas?

浪尽此生 提交于 2019-11-26 19:36:45

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!

http://www.xml.com/pub/a/2004/07/21/design.html provides good guidelines and XML Schema 1.1 enables 'versioning' through conditional inclusion (http://www.w3.org/TR/xmlschema11-1/#cip).

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!