W3C home > Mailing lists > Public > xmlschema-dev@w3.org > December 2004

[xmlschema-dev] <none>

From: Chris Drozdowski <c.d@earthlink.net>
Date: Sat, 11 Dec 2004 10:38:44 -0500
Message-Id: <BDB2DB1E-4B8A-11D9-93E8-000A278A9BE2@earthlink.net>
To: xmlschema-dev@w3.org
Hello,

Can an element in an XML document be empty if it is defined as a token 
type in the schema (see example below)?
My validator will accept empty elements if the type is string but 
chokes on token.

<?xml version="1.0"?>
<people>
     <person>
         <fname>John</fname>
         <mname/>
         <lname>John</lname>
     </person>
</people>

<?xml version="1.0" encoding="ISO-8859-1"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

<xs:element name="people">
     <xs:complexType>
         <xs:sequence>
             <xs:element name="person" type="persontype" minOccurs="0" 
maxOccurs="unbounded"/>
         </xs:sequence>
     </xs:complexType>
</xs:element>

<xs:complexType name="persontype">
     <xs:sequence>
         <xs:element name="fname" type="xs:token"/>
         <xs:element name="mfname" type="xs:token"/>
         <xs:element name="lfname" type="xs:token"/>
     </xs:sequence>
</xs:complexType>

</xs:schema>


Thanks,

Chris Drozdowski

c.d@earthlink.net
Received on Saturday, 11 December 2004 17:10:57 GMT

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