xerces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amass...@apache.org
Subject svn commit: r830474 - in /xerces/c/trunk: src/xercesc/validators/schema/ tests/src/XSTSHarness/regression/ tests/src/XSTSHarness/regression/XERCESC-1893/
Date Wed, 28 Oct 2009 09:05:47 GMT
Author: amassari
Date: Wed Oct 28 09:05:46 2009
New Revision: 830474

URL: http://svn.apache.org/viewvc?rev=830474&view=rev
Log:
When the base type for a complex type cannot be found in an imported schema that has already
been processed, check if a simple type with the same name exists (XERCESC-1893)

Added:
    xerces/c/trunk/tests/src/XSTSHarness/regression/XERCESC-1893/
    xerces/c/trunk/tests/src/XSTSHarness/regression/XERCESC-1893/included.xsd
    xerces/c/trunk/tests/src/XSTSHarness/regression/XERCESC-1893/main.xsd
Modified:
    xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.cpp
    xerces/c/trunk/tests/src/XSTSHarness/regression/Xerces.testSet

Modified: xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.cpp?rev=830474&r1=830473&r2=830474&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.cpp (original)
+++ xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.cpp Wed Oct 28 09:05:46 2009
@@ -6478,13 +6478,23 @@
             baseComplexTypeInfo = getTypeInfoFromNS(elem, uriStr, localPart);
 
             if (!baseComplexTypeInfo) {
-
                 SchemaInfo* impInfo = fSchemaInfo->getImportInfo(fURIStringPool->addOrFind(uriStr));
 
-                if (!impInfo || impInfo->getProcessed()) {
+                if (!impInfo) 
+                {
                     reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::BaseTypeNotFound,
baseName);
                     throw TraverseSchema::InvalidComplexTypeInfo;
                 }
+                if (impInfo->getProcessed())
+                {
+                    // the schema has already been loaded, so check if it's a simple type
before complaining
+                    baseDTValidator = getDatatypeValidator(uriStr, localPart);
+                    if(!baseDTValidator)
+                    {
+                        reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::BaseTypeNotFound,
baseName);
+                        throw TraverseSchema::InvalidComplexTypeInfo;
+                    }
+                }
 
                 infoType = SchemaInfo::IMPORT;
                 restoreSchemaInfo(impInfo, infoType);

Added: xerces/c/trunk/tests/src/XSTSHarness/regression/XERCESC-1893/included.xsd
URL: http://svn.apache.org/viewvc/xerces/c/trunk/tests/src/XSTSHarness/regression/XERCESC-1893/included.xsd?rev=830474&view=auto
==============================================================================
--- xerces/c/trunk/tests/src/XSTSHarness/regression/XERCESC-1893/included.xsd (added)
+++ xerces/c/trunk/tests/src/XSTSHarness/regression/XERCESC-1893/included.xsd Wed Oct 28 09:05:46
2009
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://included">
+	<xs:simpleType name="Int32_Type">
+		<xs:restriction base="xs:int">
+			<xs:minInclusive value="-2147483648"/>
+			<xs:maxInclusive value="2147483647"/>
+		</xs:restriction>
+	</xs:simpleType>
+</xs:schema>

Added: xerces/c/trunk/tests/src/XSTSHarness/regression/XERCESC-1893/main.xsd
URL: http://svn.apache.org/viewvc/xerces/c/trunk/tests/src/XSTSHarness/regression/XERCESC-1893/main.xsd?rev=830474&view=auto
==============================================================================
--- xerces/c/trunk/tests/src/XSTSHarness/regression/XERCESC-1893/main.xsd (added)
+++ xerces/c/trunk/tests/src/XSTSHarness/regression/XERCESC-1893/main.xsd Wed Oct 28 09:05:46
2009
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+        xmlns:nums="http://included"
+        targetNamespace="http://main">
+	<xs:import namespace="http://included" schemaLocation="included.xsd"/>
+	<xs:complexType name="A_Number_Type">
+		<xs:simpleContent>
+			<xs:extension base="nums:Int32_Type">
+				<xs:attribute name="Tag" type="xs:int"/>
+			</xs:extension>
+		</xs:simpleContent>
+	</xs:complexType>
+
+</xs:schema>
\ No newline at end of file

Modified: xerces/c/trunk/tests/src/XSTSHarness/regression/Xerces.testSet
URL: http://svn.apache.org/viewvc/xerces/c/trunk/tests/src/XSTSHarness/regression/Xerces.testSet?rev=830474&r1=830473&r2=830474&view=diff
==============================================================================
--- xerces/c/trunk/tests/src/XSTSHarness/regression/Xerces.testSet (original)
+++ xerces/c/trunk/tests/src/XSTSHarness/regression/Xerces.testSet Wed Oct 28 09:05:46 2009
@@ -707,4 +707,15 @@
       <current status="accepted" date="2009-07-28"/>
     </instanceTest>
   </testGroup>
+  <testGroup name="XERCESC-1893">
+    <annotation>
+      <documentation>Error reported when defining a complex type as an extension of
an imported simple type</documentation>
+    </annotation>
+    <documentationReference xlink:href="https://issues.apache.org/jira/browse/XERCESC-1893"/>
+    <schemaTest name="XERCESC-1893">
+      <schemaDocument xlink:href="./XERCESC-1893/main.xsd"/>
+      <expected validity="valid"/>
+      <current status="accepted" date="2009-10-28"/>
+    </schemaTest>
+  </testGroup>
 </testSet>



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


Mime
View raw message