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=27828>. 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=27828 incorrect validation of substitution groups with restriction Summary: incorrect validation of substitution groups with restriction Product: Xerces2-J Version: 2.6.2 Platform: PC OS/Version: Windows XP Status: NEW Severity: Major Priority: Other Component: XML Schema Structures AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] I'm seeing some oddities with the validation of certain constructs using restriction and substitution groups, that intuitively do not make sense, and which I cannot account for by the spec. I'm including simple test schemas, whose name I'll refer to in the below; what I'm seeing are the following: All my examples start with a base element and its global complex type which is a sequence of another element (1,n), also with global type (see base1-n.xsd). From that I derive types from both these types by restriction, and define elements from those types, declaring those elements to be in the substitution group of the elements defined as the base type. What I end up with is a structure that is a restricted form of the base, using different element names. This works, mostly, however I get errors in several cases in which as far as I can tell from the spec, I should not. In particular I get a RecurseLax.2 error if my derived sequence is a single derived element (1,n) (see deriv_1-n_simple.xsd). I can make this go away by inserting a superfluous choice group between the sequence and the element, making the choice (1,n) and the element (1,1) (see deriv_1-n_extra_choice.xsd). This kind of makes sense given the spec's requiring substitution groups be treated as choices in just this manner, however the validator surely shouldn't require derivations to mimic this implicit structure explicitly. Another case is where instead of that sequence of one derived element (1,n) I substitute several derived elements, each (1,1) and the base element again (1,1) (see deriv-3seq-plus.xsd). This gives me a MapAndSum.1 error. Without the base element it validates fine. If instead of the base element, I use another element declare as the type the base type itself (not a derived type) it also validates. However if the last element is (1,n) (derived or base) it fails with that MapAndSum.1. I don't include all the example schemas for these...to save space I let whoever tries this make the alterations themselves. Example schemas: base1-N.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"> <xs:complexType> <xs:complexContent> <xs:extension base="test:outerType"/> </xs:complexContent> </xs:complexType> </xs:element> <xs:complexType name="outerType"> <xs:sequence> <xs:element ref="test:inner" 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> deriv_1-n_simple.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" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:include schemaLocation="base-1toN.xsd"/> <xs:element name="dervOuter" type="test:dervOuterType"/> <xs:element name="dervInnerA" type="test:dervInnerType" substitutionGroup="test:inner"/> <xs:simpleType name="dervInnerType"> <xs:restriction base="test:innerType"> <xs:pattern value="-?[0-9]{1,3}"/> </xs:restriction> </xs:simpleType> <xs:complexType name="dervOuterType"> <xs:complexContent> <xs:restriction base="test:outerType"> <xs:sequence> <xs:element ref="test:dervInnerA" maxOccurs="unbounded"/> </xs:sequence> </xs:restriction> </xs:complexContent> </xs:complexType> </xs:schema> deriv_1-n_extra_choice.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:include schemaLocation="base-1toN.xsd"/> <xs:element name="dervOuter" type="test:dervOuterType"/> <xs:element name="dervInnerA" type="test:dervInnerType" substitutionGroup="test:inner"/> <xs:simpleType name="dervInnerType"> <xs:restriction base="test:innerType"> <xs:pattern value="-?[0-9]{1,3}"/> </xs:restriction> </xs:simpleType> <xs:complexType name="dervOuterType"> <xs:complexContent> <xs:restriction base="test:outerType"> <xs:sequence> <xs:choice maxOccurs="unbounded"> <xs:element ref="test:dervInnerA"/> </xs:choice> </xs:sequence> </xs:restriction> </xs:complexContent> </xs:complexType> </xs:schema> deriv-3seq-plus.xsd: <?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-1toN.xsd"/> <xs:element name="dervOuter" type="test:dervOuterType"/> <xs:element name="dervInnerA" type="test:dervInnerType" substitutionGroup="test:inner"/> <xs:element name="dervInnerB" type="test:dervInnerType" substitutionGroup="test:inner"/> <xs:element name="dervInnerC" type="test:dervInnerType" substitutionGroup="test:inner"/> <xs:simpleType name="dervInnerType"> <xs:restriction base="test:innerType"> <xs:pattern value="-?[0-9]{1,3}"/> </xs:restriction> </xs:simpleType> <xs:complexType name="dervOuterType"> <xs:complexContent> <xs:restriction base="test:outerType"> <xs:sequence> <xs:element ref="test:dervInnerA"/> <xs:element ref="test:dervInnerB"/> <xs:element ref="test:dervInnerC"/> <xs:element ref="test:inner"/> </xs:sequence> </xs:restriction> </xs:complexContent> </xs:complexType> <xs:element name="dervInnerSameType" type="test:innerType" substitutionGroup="test:inner"/> </xs:schema> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
