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]
Optionality, Collectors, and validity

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.

Thanks

tc



“The single biggest problem in communication is the illusion that it has
taken place.” 
– George Bernard Shaw.

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@gmail.com
Phone: (919)619-2104
http://www.tcnine.com/
blog: www.NewDaedalus.com





[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