W3C home > Mailing lists > Public > xmlschema-dev@w3.org > September 2006

optional textnode in element

From: Christian Setzkorn <christian@setzkorn.eu>
Date: Tue, 19 Sep 2006 13:12:48 +0100
To: <xmlschema-dev@w3.org>
Message-ID: <003f01c6dbe4$ebfeab40$a9d5fd8a@Zoonosis1>

Hi,

How can I define that an elements text node is ‘optional’ for an element
like this one:

<xs:element>
          <xs:simpleType>
            <xs:restriction base="xs:integer">
              <xs:minInclusive value="1" />
              <xs:maxInclusive value="100" />
            </xs:restriction>
          </xs:simpleType>
        </xs:element>

So that this:

<number>70</number>

and this is possible:

</number>

Any feedback would be very much appreciated. Many thanks.

Chris

PS: I am also a bit confused about the nil value. Van der Vilst writes in
his book: “an empty element is not always null, but a null element must be
empty.” ???? 

Are you aware of articles that may clarify this a bit more? Thanks!

BTW: In statistics the whole thing gets even more complicated. I can have
something like MCAR (missing completely at random), MAR (missing at random),
MNAR (missing not at random. To model this I would use something like this:

<?xml version="1.0" encoding="utf-16"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="test">
    <xs:complexType>
      <xs:choice>
        <xs:element>
          <xs:simpleType>
            <xs:restriction base="xs:integer">
              <xs:minInclusive value="1" />
              <xs:maxInclusive value="100" />
            </xs:restriction>
          </xs:simpleType>
</xs:element>
<xs:element>
<xs:simpleType>
<	xs:restriction base="xs:NMTOKEN">
		<xs:enumeration value=”MCAR”/>
<xs:enumeration value=”MAR”/>
<xs:enumeration value=”MNAR”/>
			</xs:restriction>
</xs:simpleType>
        	</xs:element>
      </xs:choice>
    </xs:complexType>
  </xs:element>
</xs:schema> 

What do you think?




-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.405 / Virus Database: 268.12.5/450 - Release Date: 18/09/2006
 
Received on Tuesday, 19 September 2006 12:13:05 GMT

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