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]
RE: Use-case for a complex type that has no valid content?

Here's an idea: use the empty choice as a way to express "I'm terminating my connection with you".


For example, a sender creates XML documents containing data of either books, magazines, or Kindles. At some point the sender wants to signal that he will send no further XML documents. So the XML Schema is created in which one of the choices is a Halt element (of type ValidationKiller):


    <xs:element name="Document">



                <xs:element name="Books" type="BooksType" />

                <xs:element name="Magazines" type="MagazinesType" />

                <xs:element name="Kindles" type="KindlesType" />

                <xs:element name="Halt" type="ValidationKiller" />





where ValidationKiller is a complexType containing an empty choice:


<xs:complexType name="ValidationKiller">




To halt the communication the sender sends this XML document:






That fails validation and thus terminates the connection.


Is that a reasonable use of ValidationKiller?





From: Costello, Roger L.
Sent: Tuesday, June 02, 2015 1:45 PM
To: xml-dev@lists.xml.org
Subject: Use-case for a complex type that has no valid content?


Hi Folks,


Thanks for the outstanding responses.


I have learned that an empty choice:


    <xs:complexType name="ValidationKiller">


has no valid content, i.e., the set of valid content is the empty set, {}.


When would one use such a complex type? Can you think of a use-case for it?



[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