W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > January to March 2001

Is there an indicator for the root element?

From: Zhang, Tao <TZhang@coair.com>
Date: Wed, 7 Mar 2001 11:22:46 -0600
Message-ID: <0FAF1EF6D259D2119F7900805FA7A8A20A13AAE2@CHQSEXC02>
To: "'www-xml-schema-comments@w3.org'" <www-xml-schema-comments@w3.org>

Hi,

Is there a standard way to indicate which of the top-level defined elements
in the Schema is the 
real root element in the instance XML document? And this indication can be
catched by a program
when processing only the Schema. And is there a constraint that other
top-level defined elements,
if not root element in the instance XML document, must be referred by later
defined elements?

For example, consider this Schema file and suppose there is no instance XML
files available:

	<xsd:schema xmlns:xsd="http://www.w3.org/2000/08/XMLSchema">

	 <xsd:element name="purchaseOrder" type="PurchaseOrderType"/>

	 <xsd:element name="comments" type="Remarks"/>

	 <xsd:complexType name="PurchaseOrderType">
	  <xsd:sequence>
	   <xsd:element name="shipTo" type="Address"/>
	   <xsd:element name="billTo" type="Address"/>
	   <xsd:element name="items"  type="xsd:string"/>
	  </xsd:sequence>
	  <xsd:attribute name="orderDate" type="xsd:date"/>
	 </xsd:complexType>

	 <xsd:complexType name="Address">
	  <xsd:sequence>
	   <xsd:element name="name"   type="xsd:string"/>
	   <xsd:element name="street" type="xsd:string"/>
	   <xsd:element name="city"   type="xsd:string"/>
	   <xsd:element name="state"  type="xsd:string"/>
	   <xsd:element name="zip"    type="xsd:decimal"/>
	  </xsd:sequence>
	  <xsd:attribute name="country" use="fixed" value="US"/>
	 </xsd:complexType>

	 <xsd:complexType name="Remarks">
	  <xsd:sequence>
	   <xsd:element name="preferReceiveBy" type="xsd:date"/>
	   <xsd:element name="specialConcern" type="xsd:string"/>
	  </xsd:sequence>
	 </xsd:complexType>
	 
	</xsd:schema>

It seems there is not way to tell whether it is "purchaseOrder"or "comments"
the real root element
in the instance XML file. 

Any suggestion and explanation will be greatly appreciated.

Tao
Received on Wednesday, 7 March 2001 12:23:36 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Sunday, 6 December 2009 18:12:49 GMT