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]
Re: [xml-dev] Problem using <xsd:all>

Hi Paul,

Paul Stepowski wrote:
> That is, I require either:
> 
> <tasklist>
>  <success/>
>  <failure/>
> </tasklist>
> 
> or:
> 
> <tasklist>
>  <failure/>
>  <success/>
> </tasklist>
I think your schema definition then should look something like:
<xsd:element name="tasklist">
  <xsd:complexType>
    <xsd:all>
      <xsd:element ref="success" minOccurs="1" maxOccurs="1" />
      <xsd:element ref="failure" minOccurs="1" maxOccurs="1" />
    </xsd:all>
  </xsd:complexType>
</xsd:element>

The <xsd:all> should do the job here, as to that one requirement.
The problem with your first XSD was that you defined an <xsd:all> inside
some <xsd:sequence>, where nesting <xsd:all> inside <xsd:sequence>
doesn't work.

If your <tasklist> may also contain other elements which you don't want
to apply the rules of <xsd:all>, it could be a lot easier to wrap your
special <success> and <failure> elements inside another element like:

<tasklist>
  <foo />
  <bar />
  <status>
    <failure />
    <success />
  </status>
</tasklist>

This enables you to use desired <xsd:sequence> for <tasklist> and use
the <xsd:all> for <status> containing only <failure> and <success>, each
occurring once.

Best Regards
-- Dennis Sterzenbach


[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