mixed attribute for character data

The following xml has been picked up from XML Schema Part 0. It contains
character data between child elements.

<letterBody>
	<salutation>Dear Mr.
		<name>Robert Smith</name>
		.
	</salutation>
	Your order of 
	<quantity>1</quantity>
	 
	<productName>BabyMonitor</productName>
	 shipped from our warehouse on
	<shipDate>1999-05-21</shipDate>. ....
</letterBody>

As per the xmlschema primer the mixed attribute is set to true to allow
character data to be present between child elements. But is there any
way to validate the occurrence of such character data ? i.e.in the above
xml can a schema be used to ensure that the text 'Your order of' and
'shipped from our warehouse on' will always be present (or not present).

The following xsd for the above xml was picked up from the xmlschema
primer and it does not have any information about the number or position
of such text nodes for the element 'letterbody'. The 'mixed' attribute
seems to signify that the element may contain text but there is no way
to indicate whether the text is mandatory or where that text should
appear - between two child elements or before all elements etc..
<xsd:element name="letterBody">
 <xsd:complexType mixed="true">
  <xsd:sequence>
   <xsd:element name="salutation">
    <xsd:complexType mixed="true">
     <xsd:sequence>
      <xsd:element name="name" type="xsd:string"/>
     </xsd:sequence>
    </xsd:complexType>
   </xsd:element>
   <xsd:element name="quantity"    type="xsd:positiveInteger"/>
   <xsd:element name="productName" type="xsd:string"/>
   <xsd:element name="shipDate"    type="xsd:date" minOccurs="0"/>
   <!-- etc. -->
  </xsd:sequence>
 </xsd:complexType>
</xsd:element>
My question is - isn't there a way to use the schema to validate the
occurrence of character data between child elements? 
Thanks,
Anu

Received on Thursday, 14 February 2002 07:39:13 UTC