W3C home > Mailing lists > Public > xmlschema-dev@w3.org > February 2002

mixed attribute for character data

From: Anuradha Agarkar Goel <aagarkar@in.firstrain.com>
Date: Thu, 14 Feb 2002 18:13:50 +0530
Message-ID: <205C5F16CA92F94484F054E94520F4D7044A8E@mail.in.firstrain.com>
To: <xmlschema-dev@w3.org>
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 GMT

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