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

Are these schemas equivalent?

From: Andreas Schneider <andreas.s@befree.ch>
Date: Sat, 18 Jan 2003 17:36:12 +0100
To: xmlschema-dev@w3.org
Message-Id: <F4E1073D-2B02-11D7-BA37-000393C309F2@befree.ch>

I am working on a XSLT transformation from XML to HTML for a Biological 
database.

Each document (called "card") contains genomic information about one 
gene from several resource databases.

How could/should such a document  be tagged? Are the three solutions 
below equivalent? What approach would you prefer? Why?

XML data is transformed by XSLT stylesheets into XML and HTML documents.

(Restriction: no attributes)

 >>>>>>>  1. (Existing) Schema Solution defining types of same element 
for each resource:

XSD:

<schema>
<element name="CARD" content="elementOnly">
<element name="Resource" minOccurs="1" content="mixed">
<type name="HUGO" minOccurs="0">
<element name="hugoinfo" type="string" />
...
</type>
<type name="GENBANK" minOccurs="0">
<element name="genbankinfo" type="string" />
...
</type>
</element>
</element>
</schema>

This is the existing solution which uses content="mixed" instead of 
mixed="true" and type instead of complexType. Is this a problem? Is it 
still ok to define types like this?

XML:

<CARD>
<Resource>HUGO
<hugoinfo> ...</hugoinfo>
  ...
</Resource>
<Resource>GENBANK
<genebankinfo> ...</genbankinfo>
...
  </Resource>
...
</CARD>

Is this XML conformant to above XSD?


 >>>>>>>  2. Solution with additional tag for resource name:

XSD:

<schema>
<element name="CARD" content="elementOnly">
<element name="Resource" minOccurs="1">
<complexType name="HUGO">
<sequence>
<element name="resourcename" type="string" />
<element name="hugoinfo" type="string" />
...
</sequence>
</complexType>
<complexType name="GENBANK">
<sequence>
<element name="resourcename" type="string" />
<element name="genbankinfo" type="string" />
...
</sequence>
</complexType>
</element>
</element>
</schema>


XML:

<CARD>
<Resource>
<resourcename>HUGO</resourcename>
<element name="hugoinfo" type="string" />
  ...
</Resource>
<Resource>
<resourcename>GENBANK</resourcename>
<element name="genbankinfo" type="string" />
...
</Resource>
...
</CARD>

 >>>>>>>  3. Solution with distinct elements for each resource (my 
proposal):

XSD:

<schema>
<element name="CARD" type="ByResources" />

<complexType name="ByResources" mixed="false">
<sequence>
<element name="HUGO" minOccurs="0" mixed="false">
<complexType>
<sequence>
<element name="hugoinfo" type="string" />
...
</sequence>
</complexType>
</element>
<element name="GENBANK" minOccurs="0" mixed="false" >
<complexType>
<sequence>
<element name="genbankinfo" type="string" />
...
</sequence>
</complexType>
</element>
</sequence>
</complexType>
</schema>


XML:
<CARD>
<HUGO>
<hugoinfo>...</hugoinfo>
...
  </HUGO>
<GENBANK>
<genbankinfo>...</genbankinfo>
  ...
  </GENBANK>
...
</CARD>
Received on Sunday, 19 January 2003 12:27:58 GMT

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