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 2001/09/11 09:57:08 UTC

[DO NOT REPLY: Bug 3541] New: schema error not reported for complexType on restricted substitutionGroup

PLEASE DO NOT REPLY TO THIS MESSAGE. TO FURTHER COMMENT
ON THE STATUS OF THIS BUG PLEASE FOLLOW THE LINK BELOW
AND USE THE ON-LINE APPLICATION. REPLYING TO THIS MESSAGE
DOES NOT UPDATE THE DATABASE, AND SO YOUR COMMENT WILL
BE LOST SOMEWHERE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=3541

*** shadow/3541	Tue Sep 11 00:57:08 2001
--- shadow/3541.tmp.24008	Tue Sep 11 00:57:08 2001
***************
*** 0 ****
--- 1,102 ----
+ +============================================================================+
+ | schema error not reported for complexType on restricted substitutionGroup  |
+ +----------------------------------------------------------------------------+
+ |        Bug #: 3541                        Product: Xerces-J                |
+ |       Status: NEW                         Version: 1.4.3                   |
+ |   Resolution:                            Platform: Sun                     |
+ |     Severity: Minor                    OS/Version: Solaris                 |
+ |     Priority: Other                     Component: Schema-Structures       |
+ +----------------------------------------------------------------------------+
+ |  Assigned To: xerces-j-dev@xml.apache.org                                  |
+ |  Reported By: stuartwelham@yahoo.co.uk                                     |
+ |      CC list: Cc:                                                          |
+ +----------------------------------------------------------------------------+
+ |          URL:                                                              |
+ +============================================================================+
+ |                              DESCRIPTION                                   |
+ When the following Schema 
+ 
+ <?xml version="1.0" encoding="UTF-8"?>
+ <xsd:schema 
+     targetNamespace="http://www.example.com/Who" 
+     xmlns="http://www.example.com/Who" 
+     xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+     finalDefault="restriction"
+     xml:lang="en-GB">
+ 
+     <xsd:annotation>
+         <xsd:documentation>
+             XML Schema to test SubstitutionGroups with xsd:anyType head 
+         </xsd:documentation>
+     </xsd:annotation>
+ 
+     <xsd:element
+         name="anyHead"
+         type="xsd:anyType"/>
+ 
+     <xsd:element
+         name="simpleSubstitute"
+         substitutionGroup="anyHead"
+         type="xsd:string"/>
+ 
+     <xsd:element
+         name="complexSubstitute"
+         substitutionGroup="anyHead">
+         <xsd:complexType>
+             <xsd:simpleContent>
+                 <xsd:extension base="xsd:string"/>
+             </xsd:simpleContent>
+         </xsd:complexType>
+     </xsd:element>
+ 
+     <xsd:element
+         name="MotherHen">
+         <xsd:complexType>
+             <xsd:sequence>
+                 <xsd:element 
+                     ref="anyHead"
+                     maxOccurs="unbounded"/>
+             </xsd:sequence>
+         </xsd:complexType>
+     </xsd:element>
+ 
+ </xsd:schema>
+ 
+ is used with the instance document
+ 
+ <?xml version="1.0" encoding="UTF-8"?>
+ <MotherHen 
+     xmlns="http://www.example.com/Who" 
+     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+     xsi:schemaLocation="http://www.example.com/Who Substitution.xsd">
+     <complexSubstitute>John Entwhistle</complexSubstitute>
+     <simpleSubstitute>Pete Townsend</simpleSubstitute>
+ </MotherHen>
+ 
+ xerces reports an error on simpleSubstitute but fails to report an error on 
+ complexSubstitute.
+ 
+ NOTE: Bug report from query on xerces-j-user mailing list. 
+ http://marc.theaimsgroup.com/?l=xerces-j-user&m=100013535924476&w=2
+ Reply from Sandy Gao as follows :
+ 
+ In the declaration of "anyHead" element, no "final" is specified, so
+ "finalDefault" of the <schema> element is used, and {substitution group
+ exclusions} for "anyHead" is "restriction".
+ 
+ "Schema Component Constraint: Element Declaration Properties Correct",
+ point 3:
+ "3 If there is an {substitution group affiliation}, the {type definition}
+ of the element declaration must be validly derived from the {type
+ definition} of the {substitution group affiliation}, given the value of the
+ {substitution group exclusions} of the {substitution group affiliation}, as
+ defined in Type Derivation OK (Complex) (�3.4.6) (if the {type definition}
+ is complex) or as defined in Type Derivation OK (Simple) (�3.14.6) (if the
+ {type definition} is simple)."
+ 
+ That means, any element of a type that's derived by "restriction" from the
+ type of "anyHead" (anyType in this case) is not allowed to substitute
+ "anyHead". So the parser is correct to report an error on
+ "simpleSubstitute". For the same reason, the parser should also report an
+ error on "complexSubstitute", but it fails to, which is a bug. I'll look
+ into it, and fixed it if possible.

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