Is there an indicator or constraint on the root element?

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="xsd:string"/>

	 <xsd:complexType name="PurchaseOrderType">
	  <xsd:sequence>
	   <xsd:element name="shipTo" type="Address"/>
	   <xsd:element name="billTo" type="Address"/>
	   <xsd:element ref="comments" minOccurs="0"/>
	   <xsd:element name="items"  type="Items"/>
	  </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="Items">
	  <xsd:sequence>
	   <xsd:element name="item" minOccurs="0" maxOccurs="unbounded">
	    <xsd:complexType>
	     <xsd:sequence>
	      <xsd:element name="productName" type="xsd:string"/>
	      <xsd:element name="quantity">
	       <xsd:simpleType>
	        <xsd:restriction base="xsd:positiveInteger">
	         <xsd:maxExclusive value="100"/>
	        </xsd:restriction>
	       </xsd:simpleType>
	      </xsd:element>
	      <xsd:element name="price"    type="xsd:decimal"/>
	      <xsd:element ref="comments"   minOccurs="0"/>
	      <xsd:element name="shipDate" type="xsd:date" minOccurs="0"/>
	     </xsd:sequence>
	     <xsd:attribute name="partNum" type="xsd:string"/>
	    </xsd:complexType>
	   </xsd:element>
	  </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 explaination will be greatly appreciated.

Tao

Received on Wednesday, 7 March 2001 12:09:09 UTC