SAXON bug? Restricting a complexType with simpleContent using a complexType with simpleContent (union) produces an error

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

SAXON bug? Restricting a complexType with simpleContent using a complexType with simpleContent (union) produces an error

Costello, Roger L.
Hi Michael,

The below produces an error. I think it should not produce an error. What do you think?

    <xs:complexType name="C1">
        <xs:simpleContent>
            <xs:extension base="xs:string" />
        </xs:simpleContent>
    </xs:complexType>
   
    <xs:complexType name="C2">
        <xs:simpleContent>
            <xs:restriction base="C1">
                <xs:simpleType>
                    <xs:union memberTypes="xs:token"/>
                </xs:simpleType>
            </xs:restriction>
        </xs:simpleContent>
    </xs:complexType>

/Roger

------------------------------------------------------------------------------
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Reply | Threaded
Open this post in threaded view
|

Re: SAXON bug? Restricting a complexType with simpleContent using a complexType with simpleContent (union) produces an error

Michael Kay
This is the error that Saxon 9.7 produces:

Loading schema document file:/Users/mike/Desktop/temp/test.xsd
Finished loading schema document file:/Users/mike/Desktop/temp/test.xsd
Error on line 10 of test.xsd:
  The complex type C2 has simple content of a type that is not validly derived from that of
  the base type. Type at test.xsd#12 is not validly derived from type xs:string
Schema processing failed: The schema is invalid

So the question is whether a union type with a single member type xs:token is validly derived from xs:string.

More specifically, does it satisfy the rules in XSD 1.1 part 2 section 3.16.6.3 Type Derivation OK (Simple)?

Let's look at these rules:

For a simple type definition (call it D, for ·derived·) to be validly ·derived· from a type definition (call this B, for base) subject to a set of blocking keywords drawn from the set {extension, restriction, list, union} (of which only restriction is actually relevant; call this set S) one of the following must be true:

1 They are the same type definition.

Clearly false.

2 All of the following are true:

2.1 restriction is not in S, or in D.{base type definition}.{final};

true.

2.2 One or more of the following is true:

2.2.1 D.{base type definition} = B.

false

2.2.2 D.{base type definition} is not ·xs:anyType· and is validly ·derived· from B given S, as defined by this constraint.

false

2.2.3 D.{variety} = list or union and B is ·xs:anySimpleType·.

false

2.2.4 All of the following are true:

2.2.4.1 B.{variety} = union.

false

2.2.4.2 D is validly ·derived· from a type definition M in B's transitive membership given S, as defined by this constraint.

N/A

2.2.4.3 The {facets} property of B and of any intervening union datatypes is empty.

N/A

So, what make you think the schema is valid?

Note: there's an oddity here. XSD 1.1 changed the rules for substitutability of complex types to define the rules by intent: if D and B are such that the valid sentences in D are a subset of the valid sentences in B, then D is a valid restriction of B. But for simple types, the rules are still defined entirely by construction. For example, an integer with range 10 to 20 is not "validly derived" from an integer with range 1 to 30, unless the first type definition is actually expressed as a restriction of the second. In other words, with simple types, A does not become substitutable for B just because the value space of A is a subset of the value space of B.

Michael Kay
Saxonica


> On 30 Nov 2015, at 19:57, Costello, Roger L. <[hidden email]> wrote:
>
> Hi Michael,
>
> The below produces an error. I think it should not produce an error. What do you think?
>
>    <xs:complexType name="C1">
>        <xs:simpleContent>
>            <xs:extension base="xs:string" />
>        </xs:simpleContent>
>    </xs:complexType>
>
>    <xs:complexType name="C2">
>        <xs:simpleContent>
>            <xs:restriction base="C1">
>                <xs:simpleType>
>                    <xs:union memberTypes="xs:token"/>
>                </xs:simpleType>
>            </xs:restriction>
>        </xs:simpleContent>
>    </xs:complexType>
>
> /Roger
>
> ------------------------------------------------------------------------------
> Go from Idea to Many App Stores Faster with Intel(R) XDK
> Give your users amazing mobile app experiences with Intel(R) XDK.
> Use one codebase in this all-in-one HTML5 development environment.
> Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
> http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140
> _______________________________________________
> saxon-help mailing list archived at http://saxon.markmail.org/
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/saxon-help 



------------------------------------------------------------------------------
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Reply | Threaded
Open this post in threaded view
|

Re: SAXON bug? Restricting a complexType with simpleContent using a complexType with simpleContent (union) produces an error

Larry Evans


On 11/30/2015 05:03 PM, Michael Kay wrote:
This is the error that Saxon 9.7 produces:

Loading schema document file:/Users/mike/Desktop/temp/test.xsd
Finished loading schema document file:/Users/mike/Desktop/temp/test.xsd
Error on line 10 of test.xsd:
  The complex type C2 has simple content of a type that is not validly derived from that of
  the base type. Type at test.xsd#12 is not validly derived from type xs:string
Schema processing failed: The schema is invalid

So the question is whether a union type with a single member type xs:token is validly derived from xs:string.

More specifically, does it satisfy the rules in XSD 1.1 part 2 section 3.16.6.3 Type Derivation OK (Simple)?

Could you provide a link to this section?  I googled for 'xsd 1.1 part 2'
which lead me to:

http://www.w3.org/TR/2011/CR-xmlschema11-2-20110721/

but a search on that page did not find 3.16.6.3 .  The closest was

        3.3.16 base64Binary
            3.3.16.1 Value Space
            3.3.16.2 Lexical Mapping
            3.3.16.3 Facets

-regards,
Larry



------------------------------------------------------------------------------
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Reply | Threaded
Open this post in threaded view
|

Re: SAXON bug? Restricting a complexType with simpleContent using a complexType with simpleContent (union) produces an error

Michael Kay
Sorry, I got the reference wrong. It's in part 1.

XSD 1.1 part 1 section 3.16.6.3 Type Derivation OK (Simple)
or more specifically


Michael Kay
Saxonica

On 1 Dec 2015, at 17:31, Larry Evans <[hidden email]> wrote:



On 11/30/2015 05:03 PM, Michael Kay wrote:
This is the error that Saxon 9.7 produces:

Loading schema document file:/Users/mike/Desktop/temp/test.xsd
Finished loading schema document file:/Users/mike/Desktop/temp/test.xsd
Error on line 10 of test.xsd:
  The complex type C2 has simple content of a type that is not validly derived from that of
  the base type. Type at test.xsd#12 is not validly derived from type xs:string
Schema processing failed: The schema is invalid

So the question is whether a union type with a single member type xs:token is validly derived from xs:string.

More specifically, does it satisfy the rules in XSD 1.1 part 2 section 3.16.6.3 Type Derivation OK (Simple)?

Could you provide a link to this section?  I googled for 'xsd 1.1 part 2'
which lead me to:

http://www.w3.org/TR/2011/CR-xmlschema11-2-20110721/

but a search on that page did not find 3.16.6.3 .  The closest was

        3.3.16 base64Binary
            3.3.16.1 Value Space
            3.3.16.2 Lexical Mapping
            3.3.16.3 Facets

-regards,
Larry


------------------------------------------------------------------------------
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help


------------------------------------------------------------------------------
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help