[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] XML Schemas: Best Practices ? Versioning
Hello everyone- Roger Costello has asked me to initiate this Best Practice topic. The results of this discussion will be posted, along with the other Best Practices, on the Best Practice Homepage (http://www.xfront.com/BestPracticesHomepage.html). Topic: What is the Best Practice for versioning XML schemas? Is it better to version a schema by: 1. Changing the (internal) schema version attribute,
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
This approach is very easy to use. Also, no change is needed to
the instance document if it is not affected by the change in the schema.
However, the validator ignores this field. Therefore, I regard the
version attribute as a cue to the human (especially if their schema doesn?t
validate) rather than an enforceable constraint. This approach could
be used in conjunction with any of the other approaches.
2. CHANGING THE SCHEMA?S TARGET NAMESPACE
<xs:schema xmlns="http://www.addressGlobalsV1.0"
Then one could update the version number in the target namespace designation with each change to the schema. With this approach, instance documents will not validate until they are changed to designate the new targetNamepsace. A disadvantage of this approach is that it forces all instance documents
to change, even if the change to the schema would not impact that instance.
Also, any schemas that ?include? this schema would have to change because
the target namespace of the included components must be the same as the
target namespace of the including schema.
3. CHANGING THE NAME OF THE SCHEMA
Since instance documents give the name and location of the associated schema, the instance documents will not validate until they are changed to designate the new schema file name. As with option 2, one disadvantage of this approach is that it forces all instance documents to change, even if the change to the schema would not impact that instance. Also, any schemas that import the modified schema would have to change since the import statement provides the name and location of the imported schema. This approach seems most powerful when used in conjunction with approaches 1 and 4. For example, one could set up a convention whereby the latest version of a particular schema is always available in a specific location under a specific filename. The version number inside the schema (and any annotations) could provide details on version number and a change history. Old versions of the schema may still be made available in an archive. This approach seems most feasible to me for implementing XML schema registries. With this approach, one always knows where to get the latest version but small changes to the schema would not impact any schemas that ?inherit? (include or import) the schema. This mimics an approach taken by the W3C on the XML Schema specification.
For example, the latest version of the ?XML Schema Specification Part 0:
Primer? is always called ?xmlschema-0?. Previous versions are available
but the file names include a date to distinguish it from the latest version.
4. CHANGING THE LOCATION OF THE SCHEMA
************ Your Opinion? ************ What is your opinion on the advantages and disadvantages of the respective approaches? Which approach do you think works best? Are there other options I have missed? Do you have a favorite way of handling schema versioning? If so,
why did you choose this approach?
Please send your comments. I?d love to hear from you. Thanks in advance for your help.
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|