[ https://issues.apache.org/jira/browse/XERCESJ-1619?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15637421#comment-15637421 ]
Lenka Svobodova commented on XERCESJ-1619: ------------------------------------------ It is generally not a good idea to place anything with variable cardinality in front of Any. In your case, this type of restriction in sequence is not allowed. You can either use minOccurs and maxOccurs set to 0, or switch to XSD 1.1 where your schemas are valid. > 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 was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: j-dev-unsubscr...@xerces.apache.org For additional commands, e-mail: j-dev-h...@xerces.apache.org