Bonjour,
J'essaie de réaliser la restriction suivante sur des choix :
<xs:complexType name="essai">
<xs:choice>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="art1"/>
<xs:element name="art2"/>
</xs:choice>
<xs:choice minOccurs="0">
<xs:element name="s1" maxOccurs="unbounded"/>
<xs:element name="s2" maxOccurs="unbounded"/>
</xs:choice>
</xs:choice>
</xs:complexType>
<xs:complexType name="essaiRestrict">
<xs:complexContent>
<xs:restriction base="essai">
<xs:choice>
<xs:choice maxOccurs="unbounded">
<xs:element ref="art1"/>
<xs:element ref="art2"/>
</xs:choice>
<xs:choice>
<xs:element
ref="s1" maxOccurs="unbounded"/>
<xs:element
ref="s2" maxOccurs="unbounded"/>
</xs:choice>
</xs:choice>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
<xs:element name="art1"/>
<xs:element name="art2"/>
<xs:element name="s1"/>
<xs:element name="s2"/>
En gros, dans essai restrict, on rend obligatoire
les un des deux choix. Bien sûr, dans cet exemple
ca ne veurt rien dire mais j'ai essayé d'isoler le problème pour simplifier.
Tous les parsers crient mais je ne comprend pas
pourquoi et la spec me promène de bout de validation en bout de validation.
Si vous avez des idées ?
Pierre
Xerces C 2.7 dit :
Error at file T:\proj\tmp\pbRestriction.xsd, line 20, char 39
Message: Recurse: There is not a complete
functional mapping between the particles
XSDValid dit :
file:/T:/proj/tmp/pbRestriction.xsd:E:20:2:
complexType is an invalid restriction of its base
type: "choice" particle is not a valid
restriction of corresponding "choice" particle in
base type [rcase-Recurse.2.1] [derivation-ok-restriction.5.3]
SQC dit :
Initializing Schema Quality Checker. Please wait ...
SchemaQualityChecker has been initialized
PROCESSING T:\proj\djo\tmp\pbRestriction.xsd time : 2006-07-13T15:29:53 ...
T:\proj\tmp\pbRestriction.xsd (file 1 of 1) now being read ...
ERROR
file = file:T:/proj/tmp/pbRestriction.xsd line 35 column 19
SEVERITY: 1
ERROR TYPE: 2
MESSAGE TYPE REFINEMENT ERROR (content type
incompatible with the content type of the basetype):
In the definition of complexType essaiRestrict,
elementOnly content model (<xs:c
hoice maxOccurs="1" minOccurs="1">
<xs:choice maxOccurs="unbounded" minOccurs="1">
<xs:element maxOccurs="1" minOccurs="1" name="art1" nillable="false"/>
<xs:element maxOccurs="1" minOccurs="1" name="art2" nillable="false"/>
</xs:choice>
<xs:choice maxOccurs="1" minOccurs="1">
<xs:element maxOccurs="unbounded"
minOccurs="1" name="s1" nillable="false"/>
<xs:element maxOccurs="unbounded"
minOccurs="1" name="s2" nillable="false"/>
</xs:choice>
</xs:choice>
) is not a restriction of elementOnly content
model (<xs:choice maxOccurs="1" mi
nOccurs="1">
<xs:choice maxOccurs="unbounded" minOccurs="0">
<xs:element maxOccurs="1" minOccurs="1" name="art1"/>
<xs:element maxOccurs="1" minOccurs="1" name="art2"/>
</xs:choice>
<xs:choice maxOccurs="1" minOccurs="0">
<xs:element maxOccurs="unbounded" minOccurs="1" name="s1"/>
<xs:element maxOccurs="unbounded" minOccurs="1" name="s2"/>
</xs:choice>
</xs:choice>
), the content type defined by the basetype.
Pierre Attar (mailto:pat@tireme.fr)
Consultant en informatique documentaire XML
Consultant in Structured Document engineering
Tirème SARL (http://www.tireme.fr)
--
Devenez redacteur <XML>fr et contribuez au developpement du
xml francophone (http://xmlfr.org/infos/redacteurs/) !
Liste de diffusion "xml-tech@xmlfr.org" (http://xmlfr.org).
Cette liste est a votre disposition pour discuter en francais de
tout sujet technique lie a XML.
Pour resilier votre abonnement, envoyez un message contenant
la commande "unsubscribe" a xml-tech-request@xmlfr.org
(mailto:xml-tech-request@xmlfr.org?Subject=unsubscribe)
Received on Thu Jul 13 16:08:26 2006