[ 
https://issues.apache.org/jira/browse/XERCESJ-1619?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13743845#comment-13743845
 ] 

Michael Glavassevich commented on XERCESJ-1619:
-----------------------------------------------

XSD 1.0's restriction rules disallow many seemingly 'logically correct' 
restrictions. I haven't checked this particular case against the spec but have 
a feeling that's what you're running into here and would more likely be allowed 
to do what you're doing with XSD 1.1 as Mukul has pointed out.
                
> Restricting a sequence of three elements with final wildcard to the wildcard 
> alone yields error
> -----------------------------------------------------------------------------------------------
>
>                 Key: XERCESJ-1619
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1619
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: XML Schema 1.0 Structures
>    Affects Versions: 2.11.0
>         Environment: oXygen 14.1 with Xerces 2.11 sentenced to work with 
> Windows 7
>            Reporter: Michael Hermann Malburg
>         Attachments: Restriction-1.xsd, Restriction-2.xsd
>
>
> I receive validation errors for #cos-particle-restrict and 
> #derivation-ok-restriction when restricting a sequence consisting of two 
> optional elements followed by an wildcard to a wildcard standing alone, see 
> example for details. The situation turn curious in inspecting the attached 
> file  (attachment "Restriction-2.xsd") which has an intermediate class 
> working fine.
> Example (attachment "Restriction-1.xsd")
> <?xml version="1.0" encoding="UTF-8"?>
> <xsd:schema attributeFormDefault="qualified" elementFormDefault="qualified" 
> targetNamespace="vdpNs"
>   version="1.0" xml:lang="en" xmlns:vdp="vdpNs" 
> xmlns:xsd="http://www.w3.org/2001/XMLSchema";>
>   <xsd:complexType name="TopType">
>     <xsd:sequence>
>       <xsd:element maxOccurs="1" minOccurs="0" name="first" type="xsd:int" />
>       <xsd:element maxOccurs="1" minOccurs="0" name="second" 
> type="xsd:string" />
>       <xsd:any maxOccurs="unbounded" minOccurs="0" namespace="##other" 
> processContents="skip" />
>     </xsd:sequence>
>   </xsd:complexType>
>   <xsd:complexType name="BottomType">
>     <xsd:complexContent>
>       <xsd:restriction base="vdp:TopType">
>         <xsd:sequence>
>           <xsd:element maxOccurs="0" minOccurs="0" name="first" 
> type="xsd:int" />
>           <xsd:element maxOccurs="0" minOccurs="0" name="second" 
> type="xsd:string" />
>           <xsd:any maxOccurs="unbounded" minOccurs="0" namespace="##other" 
> processContents="skip" />
>         </xsd:sequence>
>       </xsd:restriction>
>     </xsd:complexContent>
>   </xsd:complexType>
> </xsd:schema>
> Extract from oXygen's formatted result (belonging both to line 11 = "… 
> complexType … BottomType …"):
> Engine name: Xerces
> Severity: error
> Description: cos-particle-restrict.2: Forbidden particle restriction: 
> 'any:choice,sequence,all,elt'.
> URL: http://www.w3.org/TR/xmlschema-1/#cos-particle-restrict
> Engine name: Xerces
> Severity: error
> Description: derivation-ok-restriction.5.4.2: Error for type 'BottomType'.  
> 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
> Further observations:
>  - only forbiding one of elements "first" and "second" validates fine in both 
> cases
>  - both examples are validated with success by the W3C validator
>  - example printed inline above seems minimal in some sense
>  - changing the wildcard's namespace only leads to slightly differing results
>  - incrementing all "maxOccurs" values by 1 results in successful validation

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to