Java Reference
In-Depth Information
Versioning Schemas
Problem
There are lots of different ways to indicate versions for schemas, and you're not sure which,
if any, is most appropriate in an SOA context.
Solution
Strongly consider using some part of the namespace to indicate the schema version. This sup-
ports the canonical data model pattern. You must do so in a way that does not disrupt tools
that perform code generation, however.
Discussion
Your XML schemas will evolve over time, even those in your canonical model that you hope
to change only infrequently, so you need a strategy for versioning your schemas that will sup-
port your work on a practical level within an SOA. There are a few options, which we'll dis-
cuss here.
Use the version attribute
The most straightforward way to version a schema is to use the built-in attribute that exists
just for this purpose. It looks like this:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
version="1.0.0">
The chief benefit of versioning this way is that it's easy and doesn't require any additional
work. It is also advantageous because if the existing schema or WSDL that imports the ver-
sioned schema is compatible with the new version, it doesn't need to change.
But, as with so many easy things, it doesn't really get us what we want. The downside is that
it is not enforceable by tools. Moreover, it is not clear from an importing artifact (such as a
WSDL or another schema) what version you are using unless you also represent the version in
the location of the physical document. This becomes a maintenance issue,because it violates
the DRY (Don't Repeat Yourself) rule. It also begs the question why you'd bother asserting
the version in this attribute if it alone is not sufficient.
Search WWH ::




Custom Search