[ https://issues.apache.org/jira/browse/XERCESJ-1443?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12857492#action_12857492 ]
Kun Xu commented on XERCESJ-1443: --------------------------------- Hi Khaled, The new fix works. Thanks:) Kun > XML Schema 1.1: defect for Constraints on XML Representations of Attribute > Declarations > ---------------------------------------------------------------------------------------- > > Key: XERCESJ-1443 > URL: https://issues.apache.org/jira/browse/XERCESJ-1443 > Project: Xerces2-J > Issue Type: Bug > Components: XML Schema 1.1 Structures > Affects Versions: 2.9.1 > Reporter: Kun Xu > Assignee: Khaled Noaman > Priority: Minor > Fix For: 2.10.0 > > Attachments: XSDAttributeTraverser_patch.txt > > > Parser reports wrong error " Report an error "'attr1InB' must have a > <complexType> as an ancestor" which contradicts the XSD file." for the > following schema part. > XSD: > <?xml version="1.0"?> > <schema xmlns="http://www.w3.org/2001/XMLSchema" > xmlns:a="http://www.schemaTest.org/schema11_S3_2_3_a" > xmlns:b="http://www.schemaTest.org/schema11_S3_2_3_b" > targetNamespace="http://www.schemaTest.org/schema11_S3_2_3_a" > elementFormDefault="qualified" > attributeFormDefault="qualified"> > <import namespace="http://www.schemaTest.org/schema11_S3_2_3_b" > schemaLocation="s3_2_3v02b.xsd" /> > <complexType name="cmplxTypeInA"> > <complexContent> > <restriction base="b:cmplxTypeInB"> > <attribute name="attr1InB" type="integer" > targetNamespace="http://www.schemaTest.org/schema11_S3_2_3_b"/> > <attribute name="attr2InB" type="integer" > use="prohibited" > targetNamespace="http://www.schemaTest.org/schema11_S3_2_3_b"/> > </restriction> > </complexContent> > </complexType> > <element name="root"> > <complexType> > <sequence> > <element name="elementInA" > type="a:cmplxTypeInA"/> > </sequence> > </complexType> > </element> > </schema> > Reason: > If an attribute has an "enclosingParent", we will store its information as > following: > if (fSchemaHandler.fSchemaVersion == Constants.SCHEMA_VERSION_1_1) { > enclParent = enclosingParent; > scope = XSAttributeDecl.SCOPE_LOCAL; > } > else if (enclosingParent instanceof XSComplexTypeDecl) { > enclCT= (XSComplexTypeDecl) enclosingParent; > scope = XSAttributeDecl.SCOPE_LOCAL; > } > but when we verify the constrain: > 6.3 If the ancestor <schema> does not have a targetNamespace [attribute] or > its - actual value- is different from the - actual value- of > targetNamespace of <attribute>, then all of the following are true: > 6.3.1 <attribute> has <complexType> as an ancestor > 6.3.2 There is a <restriction> ancestor between the <attribute> and the > nearest <complexType> ancestor, and the - actual value- of the base > [attribute] of <restriction> does not - match- the name of - xs:anyType- . > we check "enclCT" only, which will always be null for schema 1.1. > Thanks:) -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: j-dev-unsubscr...@xerces.apache.org For additional commands, e-mail: j-dev-h...@xerces.apache.org