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

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

From: Andrew Welch <andrew.j.welch@gmail.com>
Date: Wed, 9 Jul 2008 13:39:03 +0100
Message-ID: <74a894af0807090539k6c8f978dy1049231bcfaa003e@mail.gmail.com>
To: "Dragon Fly" <dragon-fly999@hotmail.com>
Cc: xmlschema-dev@w3.org

2008/7/9 Dragon Fly <dragon-fly999@hotmail.com>:
> Thank you both for the information.  Andrew, what is the benefit of defining
> a "simple" element globally? For example, the nameGroup can be defined as
> follows (i.e. no refs are used for the FirstName and LastName elements).
>
> <xs:group name="nameGroup">
>   <xs:sequence>
>     <xs:element name="FirstName" type="non-empty-string"/>
>     <xs:element name="LastName" type="non-empty-string"/>
>   </xs:sequence>
> </xs:group>


- 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 :)


-- 
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/
Received on Wednesday, 9 July 2008 12:39:40 GMT

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