You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Jeffrey A Lage <jl...@funddevelopmentservices.com> on 2007/08/14 18:03:53 UTC

xs:extension and xs:all

All,

It seems to me that this should be a valid XSD:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns="http://schemas.fundevs.com/1/asgard"
         xmlns:xs="http://www.w3.org/2001/XMLSchema"
         targetNamespace="http://schemas.fundevs.com/1/asgard"
         elementFormDefault="qualified"
         attributeFormDefault="unqualified"
         id="TestSuite">

     <xs:complexType name="Column">
         <xs:all>
             <xs:element name="name" type="xs:string"/>
         </xs:all>
     </xs:complexType>

     <xs:complexType name="OutputColumn">
         <xs:complexContent>
             <xs:extension base="Column">
                 <xs:all>
                     <xs:element name="tolerance" type="xs:decimal"/>
                 </xs:all>
             </xs:extension>
         </xs:complexContent>
     </xs:complexType>

</xs:schema>


But I am receiving the following error from the parser:

cos-all-limited.1.2: An 'all' model group must appear in a particle  
with {min occurs} = {max occurs} = 1, and that particle must be part  
of a pair which constitutes the {content type} of a complex type  
definition.

Can someone explain to me why this is incorrect?


Jeffrey A. Lage | Fund Development Services
440 Park Avenue South | 14th Floor | New York | NY | 10016 | email:  
jlage@funddevelopmentservices.com | office: 212.920.3527 | mobile:  
917.536.1767




Re: xs:extension and xs:all

Posted by Michael Glavassevich <mr...@ca.ibm.com>.
Hi Jeffrey,

Pretty sure the only extension you can make to a complex type with an 
"all" model group in XML Schema 1.0 is adding additional attributes.

Thanks.

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

Jeffrey A Lage <jl...@funddevelopmentservices.com> wrote on 08/14/2007 
01:54:24 PM:

> Thanks.  So with XML Schema 1.0, is there any way to have type 
> derivation and an unordered (all) set of children elements?
> 
> On Aug 14, 2007, at 1:34 PM, Michael Glavassevich wrote:
> 
> Hi Jeffrey,
> 
> The content model of a complex type derived by extension (see {content 
> type} under the section "Complex Type Definition with complex content 
> Schema Component" [1]) consists of a sequence of the content from the 
base 
> type followed by the effective content [2] from the type you're 
declaring.
> 
> Given the composition rules, you've effectively declared this (which 
isn't 
> valid [3]):
> 
> <xs:complexType name="OutputColumn">
>  <xs:complexContent>
>   <xs:sequence>
>    <xs:all>
>     <xs:element name="name" type="xs:string"/>
>    </xs:all>
>    <xs:all>
>     <xs:element name="tolerance" type="xs:decimal"/>
>    </xs:all>
>   </xs:sequence>
>  </xs:complexContent>
> </xs:complexType>
> 
> and not
> 
> <xs:complexType name="OutputColumn">
>  <xs:complexContent>
>   <xs:all>
>    <xs:element name="name" type="xs:string"/>
>    <xs:element name="tolerance" type="xs:decimal"/>
>   </xs:all>
>  </xs:complexContent>
> </xs:complexType>
> 
> which seems to be what you wanted. You can't use type derivation to 
> achieve this with XML Schema 1.0, though I think XML Schema 1.1 might 
be 
> changing the rules a bit to allow it.
> 
> Thanks.
> 
> [1] http://www.w3.org/TR/xmlschema-1/#declare-type
> [2] http://www.w3.org/TR/xmlschema-1/#key-exg
> [3] http://www.w3.org/TR/xmlschema-1/#cos-all-limited
> 
> Michael Glavassevich
> XML Parser Development
> IBM Toronto Lab
> E-mail: mrglavas@ca.ibm.com
> E-mail: mrglavas@apache.org
> 
> Jeffrey A Lage <jl...@funddevelopmentservices.com> wrote on 08/14/2007 
> 12:03:53 PM:
> 
> All,
> 
> It seems to me that this should be a valid XSD:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns="http://schemas.fundevs.com/1/asgard" 
>         xmlns:xs="http://www.w3.org/2001/XMLSchema" 
>         targetNamespace="http://schemas.fundevs.com/1/asgard" 
>         elementFormDefault="qualified" 
>         attributeFormDefault="unqualified" 
>         id="TestSuite">
> 
>     <xs:complexType name="Column">
>         <xs:all>
>             <xs:element name="name" type="xs:string"/>
>         </xs:all>
>     </xs:complexType>
> 
>     <xs:complexType name="OutputColumn">
>         <xs:complexContent>
>             <xs:extension base="Column">
>                 <xs:all>
>                     <xs:element name="tolerance" type="xs:decimal"/>
>                 </xs:all>
>             </xs:extension>
>         </xs:complexContent>
>     </xs:complexType>
> 
> </xs:schema>
> 
> But I am receiving the following error from the parser:
> 
> cos-all-limited.1.2: An 'all' model group must appear in a particle 
> with {min occurs} = {max occurs} = 1, and that particle must be part
> of a pair which constitutes the {content type} of a complex type 
> definition.
> 
> Can someone explain to me why this is incorrect?
> 
> Jeffrey A. Lage | Fund Development Services                         
> 
> 440 Park Avenue South | 14th Floor | New York | NY | 10016 | email: 
> jlage@funddevelopmentservices.com | office: 212.920.3527 | mobile: 
> 917.536.1767
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org
> 
> Jeffrey A. Lage | Fund Development Services                         
>                                                                     
>                                                        
> 440 Park Avenue South | 14th Floor | New York | NY | 10016 | email: 
> jlage@funddevelopmentservices.com | office: 212.920.3527 | mobile: 
> 917.536.1767

---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org


Re: xs:extension and xs:all

Posted by Jeffrey A Lage <jl...@funddevelopmentservices.com>.
Thanks.  So with XML Schema 1.0, is there any way to have type  
derivation and an unordered (all) set of children elements?

On Aug 14, 2007, at 1:34 PM, Michael Glavassevich wrote:

> Hi Jeffrey,
>
> The content model of a complex type derived by extension (see {content
> type} under the section "Complex Type Definition with complex content
> Schema Component" [1]) consists of a sequence of the content from  
> the base
> type followed by the effective content [2] from the type you're  
> declaring.
>
> Given the composition rules, you've effectively declared this  
> (which isn't
> valid [3]):
>
> <xs:complexType name="OutputColumn">
>  <xs:complexContent>
>   <xs:sequence>
>    <xs:all>
>     <xs:element name="name" type="xs:string"/>
>    </xs:all>
>    <xs:all>
>     <xs:element name="tolerance" type="xs:decimal"/>
>    </xs:all>
>   </xs:sequence>
>  </xs:complexContent>
> </xs:complexType>
>
> and not
>
> <xs:complexType name="OutputColumn">
>  <xs:complexContent>
>   <xs:all>
>    <xs:element name="name" type="xs:string"/>
>    <xs:element name="tolerance" type="xs:decimal"/>
>   </xs:all>
>  </xs:complexContent>
> </xs:complexType>
>
> which seems to be what you wanted. You can't use type derivation to
> achieve this with XML Schema 1.0, though I think XML Schema 1.1  
> might be
> changing the rules a bit to allow it.
>
> Thanks.
>
> [1] http://www.w3.org/TR/xmlschema-1/#declare-type
> [2] http://www.w3.org/TR/xmlschema-1/#key-exg
> [3] http://www.w3.org/TR/xmlschema-1/#cos-all-limited
>
> Michael Glavassevich
> XML Parser Development
> IBM Toronto Lab
> E-mail: mrglavas@ca.ibm.com
> E-mail: mrglavas@apache.org
>
> Jeffrey A Lage <jl...@funddevelopmentservices.com> wrote on 08/14/2007
> 12:03:53 PM:
>
>> All,
>>
>> It seems to me that this should be a valid XSD:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <xs:schema xmlns="http://schemas.fundevs.com/1/asgard"
>>         xmlns:xs="http://www.w3.org/2001/XMLSchema"
>>         targetNamespace="http://schemas.fundevs.com/1/asgard"
>>         elementFormDefault="qualified"
>>         attributeFormDefault="unqualified"
>>         id="TestSuite">
>>
>>     <xs:complexType name="Column">
>>         <xs:all>
>>             <xs:element name="name" type="xs:string"/>
>>         </xs:all>
>>     </xs:complexType>
>>
>>     <xs:complexType name="OutputColumn">
>>         <xs:complexContent>
>>             <xs:extension base="Column">
>>                 <xs:all>
>>                     <xs:element name="tolerance" type="xs:decimal"/>
>>                 </xs:all>
>>             </xs:extension>
>>         </xs:complexContent>
>>     </xs:complexType>
>>
>> </xs:schema>
>>
>> But I am receiving the following error from the parser:
>>
>> cos-all-limited.1.2: An 'all' model group must appear in a particle
>> with {min occurs} = {max occurs} = 1, and that particle must be part
>> of a pair which constitutes the {content type} of a complex type
> definition.
>>
>> Can someone explain to me why this is incorrect?
>>
>> Jeffrey A. Lage | Fund Development Services
>>
>>
>> 440 Park Avenue South | 14th Floor | New York | NY | 10016 | email:
>> jlage@funddevelopmentservices.com | office: 212.920.3527 | mobile:
>> 917.536.1767
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org
>


Jeffrey A. Lage | Fund Development Services
440 Park Avenue South | 14th Floor | New York | NY | 10016 | email:  
jlage@funddevelopmentservices.com | office: 212.920.3527 | mobile:  
917.536.1767




Re: xs:extension and xs:all

Posted by Michael Glavassevich <mr...@ca.ibm.com>.
Hi Jeffrey,

The content model of a complex type derived by extension (see {content 
type} under the section "Complex Type Definition with complex content 
Schema Component" [1]) consists of a sequence of the content from the base 
type followed by the effective content [2] from the type you're declaring.

Given the composition rules, you've effectively declared this (which isn't 
valid [3]):

<xs:complexType name="OutputColumn">
 <xs:complexContent>
  <xs:sequence>
   <xs:all>
    <xs:element name="name" type="xs:string"/>
   </xs:all>
   <xs:all>
    <xs:element name="tolerance" type="xs:decimal"/>
   </xs:all>
  </xs:sequence>
 </xs:complexContent>
</xs:complexType>

and not

<xs:complexType name="OutputColumn">
 <xs:complexContent>
  <xs:all>
   <xs:element name="name" type="xs:string"/>
   <xs:element name="tolerance" type="xs:decimal"/>
  </xs:all>
 </xs:complexContent>
</xs:complexType>

which seems to be what you wanted. You can't use type derivation to 
achieve this with XML Schema 1.0, though I think XML Schema 1.1 might be 
changing the rules a bit to allow it.

Thanks.

[1] http://www.w3.org/TR/xmlschema-1/#declare-type
[2] http://www.w3.org/TR/xmlschema-1/#key-exg
[3] http://www.w3.org/TR/xmlschema-1/#cos-all-limited

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org

Jeffrey A Lage <jl...@funddevelopmentservices.com> wrote on 08/14/2007 
12:03:53 PM:

> All,
> 
> It seems to me that this should be a valid XSD:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns="http://schemas.fundevs.com/1/asgard" 
>         xmlns:xs="http://www.w3.org/2001/XMLSchema" 
>         targetNamespace="http://schemas.fundevs.com/1/asgard" 
>         elementFormDefault="qualified" 
>         attributeFormDefault="unqualified" 
>         id="TestSuite">
> 
>     <xs:complexType name="Column">
>         <xs:all>
>             <xs:element name="name" type="xs:string"/>
>         </xs:all>
>     </xs:complexType>
>     
>     <xs:complexType name="OutputColumn">
>         <xs:complexContent>
>             <xs:extension base="Column">
>                 <xs:all>
>                     <xs:element name="tolerance" type="xs:decimal"/>
>                 </xs:all>
>             </xs:extension>
>         </xs:complexContent>
>     </xs:complexType>
> 
> </xs:schema>
> 
> But I am receiving the following error from the parser:
> 
> cos-all-limited.1.2: An 'all' model group must appear in a particle 
> with {min occurs} = {max occurs} = 1, and that particle must be part
> of a pair which constitutes the {content type} of a complex type 
definition.
> 
> Can someone explain to me why this is incorrect?
> 
> Jeffrey A. Lage | Fund Development Services                         
>                                                                     
>                                                        
> 440 Park Avenue South | 14th Floor | New York | NY | 10016 | email: 
> jlage@funddevelopmentservices.com | office: 212.920.3527 | mobile: 
> 917.536.1767

---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org