Re: Nillable seems inconsistent

Ooop !  I think I just just realised...this has nothing to do with
nillable...the issue is the restriction which says an empty value (for the
date) is not allowed.

Sorry




I have two nillable Elements.  One validates when the tag is empty, the
other does not.  The tag that does not valid is *effectively* the same as
the validating one, i.e. a string, albeit with some associated restriction.

My question is: why don't BOTH tags fail validation when they are empty ?

Any distinction between the tags must be arbitrarily obtuse (they are in
effect simple strings)...or have I missed something ?

Please help clarify my understanding.

Many thanks

Mark Buchner


Example:

XSD
<xsd:element name="Person" type="PersonType"/>
  <xsd:complexType name="PersonType">
   <xsd:sequence>
    <xsd:element name="Name" type="xsd:string" nillable="true"/>
    <xsd:element name="DOB" type="MyDate" nillable="true"/>
   </xsd:sequence>
  </xsd:complexType>
  <xsd:simpleType name="MyDate">
   <xsd:restriction base="xsd:string">
    <xsd:length value="10"/>
    <xsd:pattern value="[0-9]{4}-[0-9]{2}-[0-9]{2}"/>
   </xsd:restriction>
  </xsd:simpleType>

XML (this validates)
<Person xmlns:xsi="..." xsi:noNamespaceSchemaLocation="myfile.xsd">
  <Name/>
  <DOB>2001-01-01</DOB>
</Person>

XML (this DOES NOT validate)
<Person xmlns:xsi="..." xsi:noNamespaceSchemaLocation="myfile.xsd">
  <Name/>
  <DOB/>
</Person>




For more information on Standard Life, visit our website
http://www.standardlife.com/

The Standard Life Assurance Company, Standard Life House, 30 Lothian Road,
Edinburgh EH1 2DH, is registered in Scotland (No. SZ4) and regulated by the
Financial Services Authority. Tel: 0131 225 2552 - calls may be recorded or
monitored. This confidential e-mail is for the addressee only. If received
in error, do not retain/copy/disclose it without our consent and please
return it to us. We virus scan and monitor all e-mails but are not
responsible for any damage caused by a virus or alteration by a third party
after it is sent.





For more information on Standard Life, visit our website
http://www.standardlife.com/

The Standard Life Assurance Company, Standard Life House, 30 Lothian Road,
Edinburgh EH1 2DH, is registered in Scotland (No. SZ4) and regulated by the
Financial Services Authority. Tel: 0131 225 2552 - calls may be recorded or
monitored. This confidential e-mail is for the addressee only. If received
in error, do not retain/copy/disclose it without our consent and please
return it to us. We virus scan and monitor all e-mails but are not
responsible for any damage caused by a virus or alteration by a third party
after it is sent.

Received on Wednesday, 10 July 2002 19:18:58 UTC