Restricting an extension on attribute uses of mixed content reports errors
--------------------------------------------------------------------------

                 Key: XERCESJ-1305
                 URL: https://issues.apache.org/jira/browse/XERCESJ-1305
             Project: Xerces2-J
          Issue Type: Bug
          Components: XML Schema Structures
    Affects Versions: 2.9.0, 2.9.1
         Environment: Xerces-J 2.9.* within Oxygen 8.* on both MacOS X and 
Windows XP
            Reporter: Fabio Vitali
         Attachments: TestMixedContent.xsd

I receive an error when restricting an extension on a mixed content type. Both 
the extension and the restriction happen on the attribute use, but the error is 
returned on the particle restriction. 

--

The example: 

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";>

<xs:complexType name="baseType" mixed="true">
    <xs:choice>
        <xs:element name="a" type="xs:string"/>
        <xs:element name="b" type="xs:string" minOccurs="0" maxOccurs="1"/>
    </xs:choice>
    <xs:attribute name="att1" type="xs:string"/>
</xs:complexType>


    <xs:complexType name="extensionType" mixed="true">
      <xs:complexContent>
          <xs:extension base="baseType">
              <xs:attribute name="att2" type="xs:string"/>
          </xs:extension>
      </xs:complexContent>
    </xs:complexType>

    <xs:complexType name="restrictionType" mixed="true">
        <xs:complexContent>
            <xs:restriction base="extensionType">
                <xs:choice>
                    <xs:element name="a" type="xs:string"/>
                    <xs:element name="b" type="xs:string" minOccurs="0" 
maxOccurs="1"/>
                </xs:choice>
                <xs:attribute name="att2" type="xs:string" fixed="somevalue"/>
            </xs:restriction>
        </xs:complexContent>
    </xs:complexType>
    
</xs:schema>

--

Errors reported: 

* cos-particle-restrict.2: Forbidden particle restriction: 
'choice:all,sequence,elt'. URL: 
http://www.w3.org/TR/xmlschema-1/#cos-particle-restrict

* derivation-ok-restriction.5.4.2: Error for type 'restrT'.  The particle of 
the type is not a valid restriction of the particle of the base. URL: 
http://www.w3.org/TR/xmlschema-1/#derivation-ok-restriction

--

Comments: 

In neither extensionType or restrictionType the content model is changed, but 
we just add first an attribute, and then restrict its values. So I don't see 
why #cos-particle-restrict should have anything to say about it. 

Neither MSXML nor XQC have anything wrong to say about the example

Remove the mixed="true" everywhere and the thing works.

Change the choices into sequences and the thing works. 

Forbid element "b" in restrictionType and the thing works  
(e.g., <xs:element name="b" type="xs:string" minOccurs="0" maxOccurs="0"/> )

Require element "b" in restrictionType and the error remains
(e.g., <xs:element name="b" type="xs:string" minOccurs="1" maxOccurs="1"/> )
 
Thank you for any light you may shed on this

Fabio Vitali

 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to