What are the best practices for versioning XML schemas?

后端 未结 2 1662
失恋的感觉
失恋的感觉 2020-11-27 12:03

I often have to design XML schemas for different XML-bases import routines. It is clear that XML schemas will evolve over time or they could contain bugs to be fixed, so it

相关标签:
2条回答
  • 2020-11-27 12:25

    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).

    0 讨论(0)
  • 2020-11-27 12:34

    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!

    0 讨论(0)
提交回复
热议问题