W3C home > Mailing lists > Public > xmlschema-dev@w3.org > July 2008

RE: Include multiple complex types into one element ...

From: Dragon Fly <dragon-fly999@hotmail.com>
Date: Wed, 9 Jul 2008 10:00:15 -0400
Message-ID: <BLU119-W38939E022D54732BF00E8B9960@phx.gbl>
To: Michael Kay <mike@saxonica.com>, 'Andrew Welch' <andrew.j.welch@gmail.com>
CC: <xmlschema-dev@w3.org>
It makes sense.  Thanks again.

> From: mike@saxonica.com
> To: andrew.j.welch@gmail.com; dragon-fly999@hotmail.com
> CC: xmlschema-dev@w3.org
> Date: Wed, 9 Jul 2008 13:49:38 +0100
> Subject: RE: Include multiple complex types into one element ...
> 
> 
> > - the element can be reused (so LastName can be used (ref'd) 
> > in multiple places)
> > 
> > - the element is defined in one place (so changing the type 
> > of LastName only needs to be done once, not everywhere that it's used)
> > 
> > - the types are exposed to applications, so you can match on 
> > type define variables as that type in schema-aware XSLT or XQuery
> > 
> > - it follows a consistent style, and turns the upper part of 
> > your schema into a data dictionary :)
> > 
> 
> And one more, if you consistently avoid using local element declarations,
> then it's easier to avoid the trap of writing
> 
> <xs:element name="person"/>
> 
> when you meant
> 
> <xs:element ref="person"/>
> 
> It's a really nasty mistake to make, because your schema document is valid
> and it validates all your valid instances, but it doesn't catch the validity
> errors that you intended to catch. That's because <xs:element
> name="person"/> defaults to <xs:element name="person" type="xs:anyType"/>
> 
> I don't condemn local element declarations entirely, however. But I tend to
> apply the rule that if you use a local element declaration then it should
> refer to a global type definition.
> 
> Michael Kay
> http://www.saxonica.com/
> 
> 

_________________________________________________________________
Making the world a better place one message at a time.
http://www.imtalkathon.com/?source=EML_WLH_Talkathon_BetterPlace
Received on Wednesday, 9 July 2008 14:00:56 GMT

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