[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

The latest version of Saxon now handles the void type (Saxon, version9.6

  • From: "Costello, Roger L." <costello@mitre.org>
  • To: "xml-dev@lists.xml.org" <xml-dev@lists.xml.org>
  • Date: Sun, 7 Jun 2015 11:13:09 +0000

The latest version of Saxon now handles the void type (Saxon

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]


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.