Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


RE: RE: Resctriction problem on complexType

From: "Xia Li" <xli@---------.--->
To: "Pierre Attar" <pat@------.-->, <xmlschema-dev@---.--->
Date: 7/14/2006 6:03:00 AM
Hi,

   I used to encounter such a problem and fix it by moving the =
occurrence constraint from the particles of a model group to the model =
group itself such as, 

        <xs:complexType name="essai">
            <xs:choice>
                <xs:choice minOccurs="0" maxOccurs="unbounded">
                    <xs:element ref="art1"/>
                    <xs:element ref="art2"/>
                </xs:choice>
                <xs:choice minOccurs="0" maxOccurs="unbounded">
                    <xs:element ref="s1"/>
                    <xs:element ref="s2"/>
                </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 maxOccurs="unbounded">
                            <xs:element ref="s1" />
                            <xs:element ref="s2"/>
                        </xs:choice>
                    </xs:choice>
                </xs:restriction>
            </xs:complexContent>
        </xs:complexType> 

I am not sure it is suitable for your case, just a possible work around.


Lisa

-----Original Message-----
From: xmlschema-dev-request@w... [mailto:xmlschema-dev-request@w...] =
On Behalf Of Pierre Attar
Sent: Thursday, July 13, 2006 7:33 AM
To: xmlschema-dev@w...
Subject: Fwd: RE: Resctriction problem on complexType


Michael,

Thanks for your answer but I don't really see 
where, in this sample, essaiRestrict complexeType  allows art1 AND s1.
The basis still remains a choice. The only 
restriction made is to make mandatory the two 
choices contained in the first one.


FYI, here are the different logs of tools :

Xerces C 2.7 :
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 :
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 :
Initializing Schema Quality Checker. Please wait ...
SchemaQualityChecker has been initialized
PROCESSING T:\proj\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.


Regards, Pierre

>at 16:13 13/07/2006, you wrote:
>>Your restricted type allows an art1 element followed by an s1 element. =
The
>>base type doesn't allow this. It's invalid to define a restricted type =
that
>>allows content that the base type doesn't permit.
>>
>>Michael Kay
>>http://www.saxonica.com/
>>
>>
>> >
>> > The aim is ti defne a restricted type by setting minOccurs to
>> > 1 to included choices.
>> >
>> > <?xml version="1.0" encoding="UTF-8"?>
>> > <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
>> > elementFormDefault="qualified" =
attributeFormDefault="unqualified">
>> >  <xs:complexType name="essai">
>> >       <xs:choice>
>> >            <xs:choice minOccurs="0" maxOccurs="unbounded">
>> >                 <xs:element ref="art1"/>
>> >                 <xs:element ref="art2"/>
>> >            </xs:choice>
>> >            <xs:choice minOccurs="0">
>> >                 <xs:element ref="s1" maxOccurs="unbounded"/>
>> >                 <xs:element ref="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"/>
>> >
>> > </xs:schema>
>> >
>> > Can anybody explain the problem ?
>> >
>> > Thanks in advance
>> >
>> > --
>> > Bruno Chatel
>> > Tel : (+33) (0)4 96 11 14 57
>> > bcha@c...
>> > http://www.chadocs.com
>> > --------------------------------------
>> >
>> >
>
>Pierre Attar (mailto:attar@t...)
>Consultant in Structured Document engineering
>Consultant en informatique documentaire
>Tir=E8me SARL (http://www.tireme.fr)
># : +33 1 43 41 12 13


Pierre Attar (mailto:pat@t...)
Consultant en informatique documentaire XML
Consultant in Structured Document engineering
Tir=E8me SARL (http://www.tireme.fr)





From mi


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent