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

RE: Optionality, Collectors, and validity

  • From: "Toby Considine" <Toby.Considine@gmail.com>
  • To: "'Michael Kay'" <mike@saxonica.com>,<xml-dev@l...>
  • Date: Sat, 26 Mar 2011 19:56:20 -0400

RE:  Optionality
Sorry, I was trying to pull stuff out of the detail of a very larger set or
cross-referential schemas - one which nests things fairly deep in
substituion patterns. I should not have had it abstract ofr this question

<xs:element name="parent" type="parentType">
<xs:complexType name="parentType">
    <xs:sequence>
        <xs:element ref="shoeSize" type="shoeSizeType"/>
        <xs:element ref="favoriteFood" type=" favoriteFoodType "/>
        <xs:element ref="components" type="ArrayOfComponents"/>
      </xs:sequence>
   </xs:complexType>

"He who fights with monsters should look to it that he himself does not
become a monster, and if you stare long into an abyss, the abyss also stares
into you."   - Fredrich Nietzche

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


-----Original Message-----
From: Michael Kay [mailto:mike@saxonica.com] 
Sent: Saturday, March 26, 2011 5:46 PM
To: xml-dev@lists.xml.org
Subject: Re:  Optionality, Collectors, and validity

You don't seem to have given us full information. Where is the element
declaration for the "parent" element? Why is "parentType" abstract?

What we can say is that the parent element instance shown will not validate
as an instance of parentType, because the "components" child element is
mandatory.

Michael Kay
Saxonica

On 26/03/2011 20:11, Toby Considine wrote:
> 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">
>    <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@gmail.com
> 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@lists.xml.org
> subscribe: xml-dev-subscribe@lists.xml.org List archive: 
> http://lists.xml.org/archives/xml-dev/
> List Guidelines: http://www.oasis-open.org/maillists/guidelines.php
>
>


_______________________________________________________________________

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@lists.xml.org
subscribe: xml-dev-subscribe@lists.xml.org List archive:
http://lists.xml.org/archives/xml-dev/
List Guidelines: http://www.oasis-open.org/maillists/guidelines.php




[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.