You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by bu...@apache.org on 2004/03/23 22:39:32 UTC

DO NOT REPLY [Bug 27882] New: - incorrect validation of restrictions of any

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=27882>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=27882

incorrect validation of restrictions of any

           Summary: incorrect validation of restrictions of any
           Product: Xerces2-J
           Version: 2.6.2
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: Major
          Priority: Other
         Component: XML Schema Structures
        AssignedTo: xerces-j-dev@xml.apache.org
        ReportedBy: Eric.J.Schwarzenbach.C88@alumni.upenn.edu


Given an open-ended base type defining a sequence containing any with a
maxOccurs ="unbounded", attempts to derive types by restriction from this,
replacing any with a sequence of multiple elements results in a Recurse.2 error.
My reading of the spec indicates that this should be validated against
NSRecurseCheckCardinality and it should be valid if I read those constraints
correctly.

Example. Base schema ("base-any.xsd"):

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://xml.wrycan.com/test/restr_sub"
xmlns:test="http://xml.wrycan.com/test/restr_sub"
xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
attributeFormDefault="unqualified">
    <xs:element name="outer" type="test:outerType"/>
    <xs:complexType name="outerType">
        <xs:sequence>
            <xs:element ref="test:inner"/>
            <xs:any namespace="##any" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:complexType>
    <xs:element name="inner" type="test:innerType"/>
    <xs:simpleType name="innerType">
        <xs:restriction base="xs:string"/>
    </xs:simpleType>
</xs:schema>

Derived schema which gets the error:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://xml.wrycan.com/test/restr_sub"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:test="http://xml.wrycan.com/test/restr_sub" elementFormDefault="qualified"
attributeFormDefault="unqualified">
    <xs:include schemaLocation="base-any.xsd"/>
    <xs:element name="dervOuter" type="test:dervOuterType"/>
    <xs:complexType name="dervOuterType">
        <xs:complexContent>
            <xs:restriction base="test:outerType">
                <xs:sequence>
                    <xs:element ref="test:inner"/>
                    <xs:sequence>                    
                        <xs:element ref="test:inner2"/>
                        <xs:element ref="test:inner3"/>
                    </xs:sequence>                    
                </xs:sequence>
            </xs:restriction>
        </xs:complexContent>
    </xs:complexType>
    <xs:element name="inner2" type="xs:token"/>
    <xs:element name="inner3" type="xs:token"/>
</xs:schema>

Removing either inner2 or inner3 results in validity.

(Note the patch for bug [Bug 27828] does not affect this)

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