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.

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

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:element name="salutation">
    <xsd:complexType mixed="true">
      <xsd:element name="name" type="xsd:string"/>
   <xsd:element name="quantity"    type="xsd:positiveInteger"/>
   <xsd:element name="productName" type="xsd:string"/>
   <xsd:element name="shipDate"    type="xsd:date" minOccurs="0"/>
   <!-- etc. -->
My question is - isn't there a way to use the schema to validate the
occurrence of character data between child elements? 
Received on Thursday, 14 February 2002 07:39:13 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:14:59 UTC