OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: [xml-dev] xs:choice question...

[ Lists Home | Date Index | Thread Index ]

Le lundi 16 janvier 2006 à 12:35 -0500, Brian J Gentry a écrit :
> 
> Hello, 
>          I have a schema that needs to require 1 of 2 elements, but
> also allow for both of them. So if the elements are A & B, then A
> alone is valid, B alone is valid, A & B are valid, but ~A & ~B is
> invalid. 
> 
> I tried the following.. 
> 
>                         <xs:choice> 
>                          <xs:sequence> 
>                                         <xs:elementname="A"minOccurs="1"/> 
>                                         <xs:elementname="B"minOccurs="0"/> 
>                          </xs:sequence> 
>                          <xs:sequence> 
>                                         <xs:elementname="A"minOccurs="0"/> 
>                                         <xs:elementname="B"minOccurs="1"/> 
>                          </xs:sequence> 
>                         </xs:choice> 
> 
> But this is not working as it makes the model non-deterministic.  Is
> there a way to solve this? 

What about:

                        <xs:choice> 
                         <xs:sequence> 
                                        <xs:elementname="A"minOccurs="1"/> 
                                        <xs:elementname="B"minOccurs="0"/> 
                         </xs:sequence> 
                         <xs:sequence> 
                                        <xs:elementname="B"minOccurs="1"/> 
                         </xs:sequence> 
                        </xs:choice> 

???

Eric

-- 
Did you know it? Python has now a Relax NG (partial) implementation.
                                          http://advogato.org/proj/xvif/
------------------------------------------------------------------------
Eric van der Vlist       http://xmlfr.org            http://dyomedea.com
(ISO) RELAX NG   ISBN:0-596-00421-4 http://oreilly.com/catalog/relax
(W3C) XML Schema ISBN:0-596-00252-1 http://oreilly.com/catalog/xmlschema
------------------------------------------------------------------------





 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS