XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
The latest version of Saxon now handles the void type (Saxon, version9.6.0.6)

Hi Folks,

 

The latest version of Saxon (version 9.6.0.6) now handles the void type (i.e., xs:choice with empty content).

 

Here is the void type:

 

    <xs:complexType name="void">
       
<xs:choice/>
   
</xs:complexType>

 

I declare the description element to be of type void:

 

    <xs:element name="cellphone">
       
<xs:complexType>
           
<xs:sequence>
               
<xs:element name="brand" type="constrained-string" />
               
<xs:element name="model" type="constrained-string" />
               
<xs:element name="weight" minOccurs="0" type="xs:nonNegativeInteger" />
               
<xs:element name="battery" minOccurs="0" type="constrained-string" />
               
<xs:element name="talk-time" minOccurs="0" type="constrained-string" />
               
<xs:element name="service-providers" minOccurs="0" type="constrained-string" />
               
<xs:element name="description" minOccurs="0" type="void" />
           
</xs:sequence>
       
</xs:complexType>
   
</xs:element>

 

If an instance document contains the description element, even if the element is empty, the instance is invalid because the void type means that no instance is valid if it contains description.

 

Thus, this instance is invalid because it contains the description element:

 

<cellphone>
   
<brand>NOKIA</brand>
   
<model>918+</model>
   
<weight>7</weight>
   
<battery>nickel-cadmium, 1100 mAh</battery>
   
<talk-time>132 minutes</talk-time>
   
<service-providers>Ameritech, Cellular One, Southwestern Bell</service-providers>
   
<description/>
</cellphone>

 

Here is the error message that Saxon generates:

 

Validation error on line 9 column 97 of Cellphone.xml:

  XSD: The content model for element <description> does not allow character content

  Validating /cellphone[1]/description[1]

  See http://www.w3.org/TR/xmlschema11-1/#cvc-complex-type clause 2.3

Validation error on line 9 column 97 of Cellphone.xml:

  XSD: In content of element <description>: Empty content is not allowed. In fact, nothing

  is allowed; the type has no valid instances

Validation of file Cellphone.xml unsuccessful

 

The following instance is valid because it does not contain the description element:

 

<cellphone>
   
<brand>NOKIA</brand>
   
<model>918+</model>
   
<weight>7</weight>
   
<battery>nickel-cadmium, 1100 mAh</battery>
   
<talk-time>132 minutes</talk-time>
   
<service-providers>Ameritech, Cellular One, Southwestern Bell</service-providers>
</cellphone>

 

No errors are generated on that instance document.

 

Neat! Thanks Saxon team!

 

/Roger

 



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS