XML Schema Element reuse vs Type reuse

Published 02 September 04 05:48 PM | christof claessens

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.

Comments

# Martijn said on September 3, 2004 04:11 AM:

so where's the GMail account? :-p

# Christof said on September 3, 2004 07:17 AM:

On its way Martijn - directly after your posted I added you but unfortunately with the wrong email address. I tried again and you should receive a confirmation about... now :-) Hope you enjoy it. Keep up the great work you're doing. Best regards!!

# XML Schema Element reuse vs Type reuse said on November 26, 2007 03:56 AM:

Pingback from  XML Schema Element reuse vs Type reuse

Leave a Comment

(required) 
(required) 
(optional)
(required)