which way is correct?

I am writing a shema for my research.

I am confused with the syntax for the schema.
The XML instance I want looks like
<RAC>
    <Graph>
       <Priv>p1</Priv>
       <MRole>m1</MRole>
       <Role>R1<Role>
    </Graph>
</RAC>

Now I have two choices. The first one is
<!-- ********************* Define the whole structure ************** -->
<xsd:element name="RAC">
   <xsd:complexType>
     <xsd:sequence>
       <xsd:element name="Graph">
         <xsd:complexType>
             <xsd:sequence>
                  <xsd:element name="Priv" type="PrivilegeType" maxOccurs="unbounded" />
              <xsd:element name="MRole" type="MRoleType" minOccurs="1" maxOccurs="1" />
                <xsd:element name="Role" type="xsd:Name" maxOccurs="unbounded" />
             </xsd:sequence>
         </xsd:complexType>
       </xsd:element>
   </xsd:sequence>
  </xsd:complexType>
</xsd:element>


The second one is 
<!-- ********************* Define the whole structure ************** -->
<xsd:element name="RAC">
   <xsd:complexType>
     <xsd:sequence>
        <xsd:element name="Graph" type="GraphType" minOccurs="0" maxOccurs="1" />
     </xsd:sequence>
   </xsd:complexType>
</xsd:element>

<!-- ******************** Define Graph Type ***************** -->
<xsd:complexType name="GraphType">
 <xsd:sequence>
  <xsd:element name="Priv" type="PrivilegeType" maxOccurs="unbounded" />
  <xsd:element name="MRole" type="MRoleType" minOccurs="1" maxOccurs="1" />
  <xsd:element name="Role" type="xsd:Name" maxOccurs="unbounded" />
 </xsd:sequence>
</xsd:complexType>


The first one is nested , while the second is seperated. Which one is correct? or both are correct?

In the view of XML Spy, they looks different, becuase the second one is displayed as "a complex Type"

thanks,

Received on Friday, 6 September 2002 14:43:19 UTC