What my last post demonstrated was actually how element reuse limits your ability to reusing an XML Schema definition.  Last few weeks I saw still too many people reusing elements over and over without considering what consequences this can have when later on a schema has to be updated, reused or extended…

Regarding the sample, which was correctly identified as invalid by Martijn, Sachin, Peter and Wilco: indeed the XML Schema spec, paragraph 3.3.3 states that “If ref is present, then all of <complexType>, <simpleType>, <key>, <keyref>, <unique>, nillable, default, fixed, form, block and type must be absent, i.e. only minOccurs, maxOccurs, id are allowed in addition to ref, along with <annotation>.”

Unless it is very clear that in each and every situation an element will have the same name and exactly the same structure, an element reference is probably not safe to use.  I prefer reusing types, wich allow for much more flexible reuse.

Thanks for the comments – you surprised me 🙂

Note: I know of a few people already but if anyone else is planning to use the BizTalk Server 2004 Transactional .NET Adapter I’ve written in a production environment, please get in contact.  I’d like to know how this goes, what you plan to use it for and how any additional needs can be further addressed.

Share this post: Email it! | bookmark it! | digg it! | reddit!