Author: amassari
Date: Mon Feb 25 07:49:57 2008
New Revision: 630890

URL: http://svn.apache.org/viewvc?rev=630890&view=rev
Log:
Validate the attributes of a simple type definition before trusting its content 
(XERCESC-1718)

Added:
    xerces/c/trunk/tests/src/XSTSHarness/regression/XERCESC-1718/
    xerces/c/trunk/tests/src/XSTSHarness/regression/XERCESC-1718/test.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=630890&r1=630889&r2=630890&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.cpp (original)
+++ xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.cpp Mon Feb 25 
07:49:57 2008
@@ -1203,6 +1203,7 @@
                                        const bool topLevel, int baseRefContext)
 {
     NamespaceScopeManager nsMgr(childElem, fSchemaInfo, this);
+
     // ------------------------------------------------------------------
     // Process contents
     // ------------------------------------------------------------------
@@ -1215,6 +1216,16 @@
         return 0;
     }
 
+    // -------------------------------------------------------------------
+    // Check attributes
+    // -------------------------------------------------------------------
+    unsigned short scope = (topLevel) ? 
GeneralAttributeCheck::E_SimpleTypeGlobal
+                                      : 
GeneralAttributeCheck::E_SimpleTypeLocal;
+
+    fAttributeCheck.checkAttributes(
+        childElem, scope, this, topLevel, fNonXSAttList
+    );
+
     if (nameEmpty) { // anonymous simpleType
         name = genAnonTypeName(fgAnonSNamePrefix);
     }
@@ -1236,16 +1247,6 @@
     DatatypeValidator* dv = fDatatypeRegistry->getDatatypeValidator(fullName);
 
     if (!dv) {
-
-        // -------------------------------------------------------------------
-        // Check attributes
-        // -------------------------------------------------------------------
-        unsigned short scope = (topLevel) ? 
GeneralAttributeCheck::E_SimpleTypeGlobal
-                                          : 
GeneralAttributeCheck::E_SimpleTypeLocal;
-
-        fAttributeCheck.checkAttributes(
-            childElem, scope, this, topLevel, fNonXSAttList
-        );
 
         // Circular constraint checking
         if (fCurrentTypeNameStack->containsElement(fullTypeNameId)) {

Added: xerces/c/trunk/tests/src/XSTSHarness/regression/XERCESC-1718/test.xsd
URL: 
http://svn.apache.org/viewvc/xerces/c/trunk/tests/src/XSTSHarness/regression/XERCESC-1718/test.xsd?rev=630890&view=auto
==============================================================================
--- xerces/c/trunk/tests/src/XSTSHarness/regression/XERCESC-1718/test.xsd 
(added)
+++ xerces/c/trunk/tests/src/XSTSHarness/regression/XERCESC-1718/test.xsd Mon 
Feb 25 07:49:57 2008
@@ -0,0 +1,21 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema"; xmlns:t="test" 
targetNamespace="test">
+
+  <simpleType name="list">
+    <list itemType="string"/>
+  </simpleType>
+
+  <complexType name="type">
+    <sequence>
+      <element name="efoo" type="string"/>
+    </sequence>
+    <attribute name="abar">
+      <simpleType name="list">
+        <list itemType="string"/>
+      </simpleType>
+    </attribute>
+  </complexType>
+
+  <element name="root" type="string"/>
+
+</schema>

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=630890&r1=630889&r2=630890&view=diff
==============================================================================
--- xerces/c/trunk/tests/src/XSTSHarness/regression/Xerces.testSet (original)
+++ xerces/c/trunk/tests/src/XSTSHarness/regression/Xerces.testSet Mon Feb 25 
07:49:57 2008
@@ -365,6 +365,17 @@
                        <current status="accepted" date="2008-02-13"/>
                </schemaTest>
        </testGroup>
+       <testGroup name="XERCESC-1718">
+               <annotation>
+                       <documentation>Invalid anonymous type definition with 
the name attribute is not caught in some situations</documentation>
+               </annotation>
+               <documentationReference 
xlink:href="https://issues.apache.org/jira/browse/XERCESC-1718"/>
+               <schemaTest name="XERCESC-1718">
+                       <schemaDocument xlink:href="./XERCESC-1718/test.xsd"/>
+                       <expected validity="invalid"/>
+                       <current status="accepted" date="2008-02-25"/>
+               </schemaTest>
+       </testGroup>
        <testGroup name="XERCESC-1745">
                <annotation>
                        <documentation>Inheritance by restriction does not 
detect a missing type from an imported schema</documentation>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to