W3C home > Mailing lists > Public > xmlschema-dev@w3.org > May 2005

Re: Versioning of XML Schema and namespaces

From: Eliot Kimber <ekimber@innodata-isogen.com>
Date: Thu, 12 May 2005 09:37:25 -0500
Message-ID: <42836A25.8070204@innodata-isogen.com>
To: xmlschema-dev@w3.org
CC: Michael Kay <mike@saxonica.com>, "'Dan Vint'" <dvint@dvint.com>, "'Fraser Crichton'" <fraser.crichton@solnetsolutions.co.nz>, John.Hockaday@ga.gov.au

Michael Kay wrote:
>>That's my reason for using the namespace with a version.
>>
>>I understand all the stated reasons for not doing this, but 
>>out of the box 
>>there is nothing else that will consistently and 
>>automatically trip up 
>>validation if I don't have the "right" file being used to validate my 
>>documents.
> 
> 
> You might make it easier for the recipient to do validation by including a
> version in the namespace, but you are making it hideously difficult for the
> recipient to process the incoming documents using namespace-aware tools such
> as XSLT and XQuery - as anyone who has tried to write code that handles the
> different flavours of RSS can tell you.

Yow! I completely forgot about this very practical reason for not 
versioning namespaces! This is really much more compelling than any 
philosophical argument I could make.

Mike is 100% correct--any namespace-aware processor, the most obvious 
example being XSLTs, may have to be significantly rewritten at the 
detail level in order to handle each new variant of the namespace for 
the same (abstract) application.

For example, consider this XSLT life cycle:

Time T[0]:

  - Application namespace is: xmlns:myns0="http://example.com/myns/v0"

  - Write template to match on element "foo" within "bar" in this namespace:

    <xsl:template match="myns0:bar/myns0:foo">

    (multiply by the number of element types in the application)

Time T[1]:

   - New version of the myns schema is released and the namespace is
updated to: xmlns:myns0="http://example.com/myns/v1"

   - Rewrite *each* template to reflect the new namespace and the old 
namespace:

    <xsl:template match="myns0:bar/myns0:foo | myns1:bar/myns1:foo">

    (multiply by the number of element types in the application)

  - Add any new templates for element types that are new (or in new 
contexts) for this new release of the application.


Clearly this represents a huge maintenance cost for any non-trivial 
application and processor that needs to support multiple versions of an 
application. And multiple by the number of namespaces used in a given 
application--if all of them version their namespaces it's going to be a 
real mess within a short period of time.

By contrast, if the namespace doesn't change, new versions of the schema 
require only adding the specific code needed to react to those changes, 
not a change to, potentially, every match= and select= statement in the 
transform.

And note that using matches of the form "*[name() = 'foo']" are not 
generally safe when processing documents that contain elements from 
different namespaces because there could easily be conflicts of local 
names (that being the whole motivation for namespaces in the first place).

Cheers,

Eliot
-- 
W. Eliot Kimber
Professional Services
Innodata Isogen
9390 Research Blvd, #410
Austin, TX 78759
(512) 372-8155

ekimber@innodata-isogen.com
www.innodata-isogen.com
Received on Thursday, 12 May 2005 14:37:07 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:50 GMT