OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: XML Schemas: Best Practices ? Versioning

Title: Message
Actually, option 1 and 1.5 aren't alternatives, they are two parts of one solution.  When you have the case 2 (the namespace really hasn't changed, the corresponding schema has been extended). you actually need both parts.  Adding the version attribute into the instance document allows the instance generator/author to declare the earliest version that the instance document is compatible with.  The version attribute within the schema could be used to declare the version of the schema.
This pattern can be seen within XSLT and SVG where there is a "version" attribute on the <xsl:transform> or <svg:svg> element to indicate what version of XSLT or SVG is in use.  At this time, there is only one legal value for version for these namespaces, however it implies that future versions of XSLT and SVG may keep the same namespace but add new values for the version attribute.  Current v1 processors are required to fail when presented with a later version attribute, however some tools (like an XSLT documentation tool) much think that it is reasonable to process just what it recognizes of a v2 document.
For greatest interoperability, you would only want to specify version="2.0" if you were using some version 2.0 features in your document and use version="1.0" otherwise.
In the case where you are making breaking changes to a definition, you have no choice but to use a distinct namespace at least for the breaking changes.  For example, if SVG 2 decided the interpretation of <rect> needed to change, but everything else in SVG 2 was upward compatible with SVG 1, there could be a new namespace just for <rect>:
<svg xmlns=http://www.w3.org/2000/svg version="2.0" xmlns:svg2="http://www.example.org/bogusuri">
    <!--   svg 1.0 rect, draws a rectangle    -->
    <rect x="10" y="20" width="20" height="20"/>
    <!--   svg 2.0 rect, draws rectanglasaurus    -->
    <svg2:rect x="10" y="20" width="30" height="20"/>