From fbbfc089f0cb66eb5e0cdac3219f4300c7f702c9 Mon Sep 17 00:00:00 2001 From: Alberto Massari <amassari@apache.org> Date: Wed, 1 Oct 2008 20:45:38 +0000 Subject: [PATCH] Process namespaces also in xs:extension/xs:restriction nodes under xs:simpleContent/xs:complexContent (XERCESC-1832) git-svn-id: https://svn.apache.org/repos/asf/xerces/c/trunk@700909 13f79535-47bb-0310-9956-ffa450edef68 --- .../validators/schema/TraverseSchema.cpp | 2 ++ .../regression/XERCESC-1832/schema11.xsd | 34 +++++++++++++++++++ .../src/XSTSHarness/regression/Xerces.testSet | 11 ++++++ 3 files changed, 47 insertions(+) create mode 100644 tests/src/XSTSHarness/regression/XERCESC-1832/schema11.xsd diff --git a/src/xercesc/validators/schema/TraverseSchema.cpp b/src/xercesc/validators/schema/TraverseSchema.cpp index 1cefe1093..d1f4e4e56 100644 --- a/src/xercesc/validators/schema/TraverseSchema.cpp +++ b/src/xercesc/validators/schema/TraverseSchema.cpp @@ -3657,6 +3657,7 @@ void TraverseSchema::traverseSimpleContentDecl(const XMLCh* const typeName, throw TraverseSchema::InvalidComplexTypeInfo; } + NamespaceScopeManager nsMgr2(simpleContent, fSchemaInfo, this); // ----------------------------------------------------------------------- // The content should be either "restriction" or "extension" // ----------------------------------------------------------------------- @@ -4079,6 +4080,7 @@ void TraverseSchema::traverseComplexContentDecl(const XMLCh* const typeName, throw TraverseSchema::InvalidComplexTypeInfo; } + NamespaceScopeManager nsMgr2(complexContent, fSchemaInfo, this); // ----------------------------------------------------------------------- // The content should be either "restriction" or "extension" // ----------------------------------------------------------------------- diff --git a/tests/src/XSTSHarness/regression/XERCESC-1832/schema11.xsd b/tests/src/XSTSHarness/regression/XERCESC-1832/schema11.xsd new file mode 100644 index 000000000..6a4bf38ef --- /dev/null +++ b/tests/src/XSTSHarness/regression/XERCESC-1832/schema11.xsd @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="utf-8"?> +<xs:schema xmlns:tns="x" elementFormDefault="qualified" targetNamespace="x" xmlns:xs="http://www.w3.org/2001/XMLSchema"> + + <xs:complexType name="derivedC"> + <xs:complexContent mixed="false" xmlns:q2="http://www.w3.org/2001/XMLSchema"> + <xs:extension xmlns:q1="x" base="q1:baseC"> + <xs:sequence xmlns:q3="http://www.w3.org/2001/XMLSchema"> + <xs:element minOccurs="0" maxOccurs="1" name="c" type="q2:boolean"/> + <xs:element minOccurs="0" maxOccurs="1" name="d" type="q3:boolean"/> + </xs:sequence> + </xs:extension> + </xs:complexContent> + </xs:complexType> + <xs:complexType name="baseC"> + <xs:sequence> + <xs:element minOccurs="0" maxOccurs="1" name="a" type="xs:string" /> + <xs:element minOccurs="0" maxOccurs="1" name="b" type="xs:string" /> + </xs:sequence> + </xs:complexType> + + <xs:simpleType name="baseS" xmlns:q6="http://www.w3.org/2001/XMLSchema"> + <q6:restriction xmlns:q4="http://www.w3.org/2001/XMLSchema" base="q4:string"> + <q5:length xmlns:q5="http://www.w3.org/2001/XMLSchema" value="3"/> + </q6:restriction> + </xs:simpleType> + + <xs:complexType name="derivedS"> + <q7:simpleContent xmlns:q7="http://www.w3.org/2001/XMLSchema"> + <xs:extension xmlns:q8="x" base="q8:baseS"> + <xs:attribute name="p" type="q7:string"/> + </xs:extension> + </q7:simpleContent> + </xs:complexType> +</xs:schema> \ No newline at end of file diff --git a/tests/src/XSTSHarness/regression/Xerces.testSet b/tests/src/XSTSHarness/regression/Xerces.testSet index 58440e738..bc0341709 100644 --- a/tests/src/XSTSHarness/regression/Xerces.testSet +++ b/tests/src/XSTSHarness/regression/Xerces.testSet @@ -568,4 +568,15 @@ <current status="accepted" date="2008-07-17"/> </instanceTest> </testGroup> + <testGroup name="XERCESC-1832"> + <annotation> + <documentation>Namespace definitions attached to xs:extension/xs:restriction are not processed</documentation> + </annotation> + <documentationReference xlink:href="https://issues.apache.org/jira/browse/XERCESC-1832"/> + <schemaTest name="XERCESC-1832"> + <schemaDocument xlink:href="./XERCESC-1832/schema11.xsd"/> + <expected validity="valid"/> + <current status="accepted" date="2008-10-01"/> + </schemaTest> + </testGroup> </testSet> -- GitLab