[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]
Re: [xml-dev] Problem using <xsd:all>
- From: Dennis Sterzenbach <lists@radds.de>
- To: Paul Stepowski <paul.stepowski@intient.com>
- Date: Tue, 02 Oct 2007 13:13:22 +0200
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]