Altova Mailing List Archives


[xml-dev] Optionality, Collectors, and validity

From: "Toby Considine" <Toby.Considine@-----.--->
To: "xml-Dev Listserv" <xml-dev@-----.---.--->
Date: 3/26/2011 8:15:00 PM
I am working on some schemas that rely on other schemas, and t we are
arguing about the validity of artifacts produced. In particular, in the
upstream schema, there are collections of things that are optionally
attached to parents. Say we have the following:

<xs:complexType name="BaseComponentType" abstract="true">
  <xs:sequence>
      <xs:element name="components" type="ArrayOfComponents"/>
    </xs:sequence>
  </xs:complexType>
  <xs:element name="baseComponent" type="BaseComponentType"/>
  <xs:complexType name="ArrayOfComponents">
    <xs:sequence>
      <xs:element ref="baseComponent" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
  </xs:complexType>

BaseComponent is an abstract type with many derivative types. With 3 4
dreivitave components, you might have an instance artifact like:

<components>
  <foo />
  <fie />
  <fee />
  <fum />
<components>

If there are no components, you might have
<components />

In the larger message, you might have a schema that specifies
<xs:complexType name="parentType" abstract="true">
  <xs:sequence>
      <xs:element ref="shoeSize" type="shoeSizeType"/>
      <xs:element ref="favoriteFood" type=" favoriteFoodType "/>
      <xs:element ref="components" type="ArrayOfComponents"/>
    </xs:sequence>
  </xs:complexType>


Clearly 
<parent>
  <shoeSize>12</shoeSize>
  <favoriteFood>nachos</favoriteFood>
  <components />
</parent>

is legal. Is 

Clearly 
<parent>
  <shoeSize>12</shoeSize>
  <favoriteFood>nachos</favoriteFood>
</parent>

Also legal? Different development tools prefer one or the other result, but
some flag the second as ill-formed. Is it legal to omit an empty sequence if
the members of the sequence are all not required?

Thanks

tc



“It is difficult to get a man to understand something, when his salary
depends upon his not understanding it” -- Upton Sinclair. 

Toby Considine
TC9, Inc
TC Chair: oBIX & WS-Calendar
TC Editor: EMIX, EnergyInterop
U.S. National Inst. of Standards and Tech. Smart Grid Architecture Committee

  
Email: Toby.Considine@g...
Phone: (919)619-2104
http://www.tcnine.com/
blog: www.NewDaedalus.com




_______________________________________________________________________

XML-DEV is a publicly archived, unmoderated list hosted by OASIS
to support XML implementation and development. To minimize
spam in the archives, you must subscribe before posting.

[Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/
Or unsubscribe: xml-dev-unsubscribe@l...
subscribe: xml-dev-subscribe@l...
List archive: http://lists.xml.org/archives/xml-dev/
List Guidelines: http://www.oasis-open.org/maillists/guidelines.php

Disclaimer

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.