W3C home > Mailing lists > Public > xmlschema-dev@w3.org > March 2003

? Named Groups vs. Named Complex Types

From: Viju Mathew <tiruvila@yahoo.com>
Date: Mon, 24 Mar 2003 08:46:56 -0800 (PST)
Message-ID: <20030324164656.72871.qmail@web13309.mail.yahoo.com>
To: xmlschema-dev@w3.org

Being new to the mailing list, I've been trying to identify some rules of thumb / best practices about when to use named Complex Types vs. Named Groups.

For instance, for the following 2 options to define a complex element, the only difference I can identify between the 2 is Readability (the 1st 'Salami Slice' design being more readable)

(these 2 element declarations are assumed for both examples)
<element name="FooElem1" type="string"/>
<element name="FooElem2" type="string"/>

-------------
(example 1) 
<element name="Foo" type="FooType"/> 

<complexType name="FooType">
  <sequence>
    <element ref="FooElem1" minOccurs="0"/>
    <element ref="FooElem2" minOccurs="0"/>
  </sequence>
</complexType> 

-----------
(example 2) 
<element name="Foo2"> 
  <complexType> 
    <sequence> 
      <group ref="FooGroup"/>
    </sequence>
  </complexType> 
</element>

<group name="FooGroup">
  <sequence>
    <element ref="FooElem1" minOccurs="0"/>
  </sequence>
</group>

Both examples achieve the declaration of a complex element. 
So, is there more to this than just weighing readability?  

Any insight would be appreciated.
Thanks,
Viju



---------------------------------
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
Received on Monday, 24 March 2003 11:49:37 GMT

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