Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Different behavior between saxon and xerces-j on the attribute use derivation mechanism

From: "Wang, Zhuo" <zhuo.wang@-----.--->
To: "Michael Kay" <mike@--------.--->, <xmlschema-dev@--.--->
Date: 12/7/2006 6:42:00 PM
Hi Mike,  

 

I'm ambiguous about the attribute use derivation mechanism according

to the schema spec one. 

 

>From spec we know that the attribute use include "required" and
"optional",

all the attribute not give out the use will be treat as "optional". But 

I don't know what "prohibited" will do. So, I write the following cases:


 

Case 1:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">

        <xs:complexType name="One">

                <xs:sequence>

                        <xs:element name="elem1" minOccurs="0"/>

                        <xs:element name="elem2" minOccurs="0" />

                </xs:sequence>

                <xs:attribute name="att1" use="prohibited"/>

                <xs:attribute name="att2" use="prohibited"/>

                <xs:attribute name="att3" use="prohibited"/>

        </xs:complexType>

        <xs:complexType name="Two">

                <xs:complexContent>

                        <xs:restriction base="One">

                                <xs:attribute name="att1"
use="prohibited"/>

                                <xs:attribute name="att2"
use="required"/>

                                <xs:attribute name="att3"
use="optional"/>

                        </xs:restriction>

                </xs:complexContent>

        </xs:complexType>

</xs:schema>

 

Case 2:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">

        <xs:complexType name="One">

                <xs:sequence>

                        <xs:element name="elem1" minOccurs="0"/>

                        <xs:element name="elem2" minOccurs="0" />

                </xs:sequence>

                <xs:attribute name="att1" use="optional"/>

                <xs:attribute name="att2" use="optional"/>

                <xs:attribute name="att3" use="optional"/>

        </xs:complexType>

        <xs:complexType name="Two">

                <xs:complexContent>

                        <xs:restriction base="One">

                                <xs:attribute name="att1"
use="prohibited"/>

                                <xs:attribute name="att2"
use="required"/>

                                <xs:attribute name="att3"
use="optional"/>

                        </xs:restriction>

                </xs:complexContent>

        </xs:complexType>

</xs:schema>

 

Case 3: 

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">

        <xs:complexType name="One">

                <xs:sequence>

                        <xs:element name="elem1" minOccurs="0"/>

                        <xs:element name="elem2" minOccurs="0" />

                </xs:sequence>

                <xs:attribute name="att1" use="required"/>

                <xs:attribute name="att2" use="required"/>

                <xs:attribute name="att3" use="required"/>

        </xs:complexType>

        <xs:complexType name="Two">

                <xs:complexContent>

                        <xs:restriction base="One">

                                <xs:attribute name="att1"
use="required"/>

                                <xs:attribute name="att2"
use="prohibited"/>

                                <xs:attribute name="att3"
use="optional"/>

                        </xs:restriction>

                </xs:complexContent>

        </xs:complexType>

</xs:schema>

 

The case1 and case2 pass the saxon validation but case3 failed. 

 

I also use xerces to validate the cases:

For case1, xerces-j failed. It only allows the prohibited to prohibited.


For case2, it pass.

For case3, it failed. It only allows required to required. 

 

I then try all kind of situation as following:

 

(1)     The xerces result:

Base type:  Sub type extension derivate from a base type directly 

 

extension                                             to opt       to
req       to prohibited

==========================
==========================
======================
=======================

Base Type Attribute Use Original value = optional      ok             =
no
ok

Base Type Attribute Use Original value = required      no             =
ok
ok

Base Type Attribute Use Original value = prohibited    no             =
no
ok

 

Base type:  Sub type restriction derivate from a base type directly

 

restriction                           to opt       to req       to
prohibited

==========================
==========================
======================
======

Original value = optional              ok             ok          ok

Original value = required              no             ok          no

Original value = prohibited            no             no          ok

 

 

Restriction: Sub type extension derivate from a restriction type 

 

extension                             to opt       to req      to
prohibited

==========================
==========================
======================
====

Original value = optional              ok           no          ok

Original value = required              no           ok          ok

Original value = prohibited            ok           ok          ok

 

                                                        Restriction: Sub
type restriction derivate from a restriction type

 

restriction                           to opt       to req     to
prohibited

==========================
==========================
======================
====

Original value = optional              ok           ok          ok

Original value = required              no           ok          no

Original value = prohibited            no           no          ok

 

(2)     The saxon result: 

 

Directly from base type: 

 

extension            opt          req       prohibited

==========================
==========================
========

optional              ok           no          no

required              no           ok          no

prohibited            no           no          ok

 

restriction          opt          req       prohibited

==========================
==========================
========

optional              ok           ok          ok

required              no           ok          no

prohibited            ok           ok          ok

 

Derivate from restriction:

 

extension            opt          req       prohibited

==========================
==========================
========

optional              ok           no          no

required              no           ok          no

prohibited            ok           ok          ok

 

restriction          opt          req       prohibited

==========================
==========================
========

optional              ok           ok          ok

required              no           ok          no

prohibited            no           no          no

 

I can't get the confirmative answer from the result, xeces2-8-1-j and
saxonsa8-8j's

behavior is much different. 

 

What exact answer about the matrix as above? I just want to make clear

the rules about the attribute use derivation between base and sub types.


 

Can you give me some suggestion about this? 

 

Thanks and Regards,

-Wang Zhuo

~~~~~~~~~~~~~~~~~~~~~~~~

Intel Asia-Pacific R&D Ltd.

~~~~~~~~~~~~~~~~~~~~~~~~

 



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