Hi all, I'm having a problem with how to make a schema based on the following snippet.

I have a element Class, and there is many Classes distinguised by their attribute Name, each Class is different in structure.


<Computers>

<Computer Name="COM20">

<Class Name="Win32_LogicalDisk">
<Caption>A:</Caption>
<Size />
<FreeSpace />
</Class>

<Class Name="Win32_LogicalDisk">
<Caption>C:</Caption>
<Size>4293562368</Size>
<FreeSpace>1856524288</FreeSpace>
</Class>

<Class Name="Win32_PageFileUsage">
<Caption>C:\pagefile.sys</Caption>
<AllocatedBaseSize>768</AllocatedBaseSize>
<CurrentUsage>139</CurrentUsage>
<Name>C:\pagefile.sys</Name>
<PeakUsage>556</PeakUsage>
</Class>
</Computer>

</Computers>

*********End of XML document. So far so good, now I define each class *******



<?xml version="1.0"?>
<xsd:schema >
<xsd:element name="Class" >
<xsd:complexType>
<xsd:attribute name = "Win32_LogicalDisk" type="xsd:string"/>
<xsd:sequence>
<xsd:element name="Caption" type="xsd:string"/>
<xsd:element name="Size" type="xsd:double"/>
<xsd:element name="FreeSpace" type="xsd:double"/>
</xsd:sequence>
</xsd:complexType>

</xsd:element>


<xsd:element name= "Class" >
<xsd:complexType>
<xsd:attribute name = "Win32_PageFileUsage" type="xsd:string"/>
<xsd:sequence>
<xsd:element name="Caption" type="xsd:string"/>
<xsd:element name="AllocatedBaseSize" type="xsd:int"/>
<xsd:element name="CurrentUsage" type="xsd:int"/>
<xsd:element name="Name" type="xsd:string"/>
<xsd:element name="PeakUsage" type="xsd:int"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>


<xsd:element name="Computer" >
<xsd:complexType>
<xsd:sequence>

*****And here my logic is flawed, when I define the structure for computer. First I want the Win32_LogicalDisk Class, and after that the Win32_PageFileUsage. The following line is NOT correct, but I can't see how I can reference a Class element by its Name attribute****

<element ref="Class" minOccurs="1" maxOccurs="unbounded" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>

</xsd:schema>