views:

192

answers:

1

I have an XSD that's going through a transition from one set of elements to another. During the transition, there'll be code expecting the new elements and code expecting the old elements. Therefore I need to keep the old elements in the XSD; I'm documenting them as deprecated (using free text in an xs:documentation element).

Is there a way of marking an element as deprecated such that a tool like xmllint will automatically warn if someone uses a deprecated element?

+1  A: 

Create a new schema, with a new namespace. Call this "version 2". If you choose to support version 1 XSD and version 2 XSD in your application that's fine, but keep them seperate and don't try to layer the two on top of each other - especially if you're going try to stop people from using the version 1.

This is worth looking at as it describes some of what you're dealing with:

http://www.pluralsight.com/community/blogs/tewald/archive/2006/04/19/22111.aspx

I realise, however, that doesn't really address your question. With regard to "is there a way to do this?" the answer is "no - not in a universally supported manner". I've seen people add their own doc annotations to give hints, but this isn't going to be universally understood by tooling.

Your best bet in the long run is to create come up with a versioning story for your schema(s) and keep version 2 seperate from version 1.

Martin Peck