module versioningAndrew Welch andrew.j.welch at gmail.com
Wed Jul 28 10:13:53 PDT 2010
On 28 July 2010 08:39, Daniela Florescu <http://x-query.com/mailman/listinfo/talk> wrote: > > Never embed version information in the namespace > > Jim Fuller gave the same answer on EXPath. OK, fine. > But can one of you please give an explanation as of WHY is it so ? > What's the downside of this ? Very often v2 is a superset of v1, and provided the namespace remains unchanged v2 can be dropped in place of v1. If the namespace changes then the application has to change just to continue to use the subset of v2. You then often have to support both versions - either everyone changes the namespace on the XML they send to your app at exactly the same time you release it, or you run both versions and they know to send v2 xml to your v2 app and v1 to your v1 app, or the most realistic outcome is that you have to support both namespaces in v2 of your app, which isn't easy... and of course a waste of time for the subset of v2 that is v1. Ultimately all of the pain goes away if you never change the namespace. The only reason to change the namespace is if the different versions of the markup need to exist in the same document, at which point your application will expect to deal with the different namespaces. That's highly unlikely, so the simple rule of "never change the namespace" is a good one for 99.9% of people. > (and BTW: if tis doesn't work, what's the OTHER option...) However you choose really, but I tend to use a version attribute on the root element, combined with a helpful filename. This works well enough in that something processing the XML has the version attribute, but you also have the filename so other things can get the version without dipping into the xml. Some people have argued in the past (on the w3c widget list iirc) that you don't need explicit versioning: if a v2 doc consists only of the v1 subset, should a v1 processor reject it? Even if it does contain v2 instructions, should the v1 processor reject the whole doc, or just process the v1 instructions it understands and ignore the v2 ones it doesn't. There doesn't seem to be clear guidance on how to version XML, perhaps something will become common once poeple stop embedding it in the namespace, or perhaps the ideal solution varies between domains (fail early vs dont fail) In the mean time, the version attribute + filename does a good enough job for me. -- Andrew Welch http://andrewjwelch.com Kernow: http://kernowforsaxon.sf.net/
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