Author: amassari
Date: Tue Feb 26 11:17:27 2008
New Revision: 631340

URL: http://svn.apache.org/viewvc?rev=631340&view=rev
Log:
Rewritten fix for XERCESC-1718 as checking for the validity of all the 
attributes multiple times would report errors when IDs are used

Modified:
    xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.cpp

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=631340&r1=631339&r2=631340&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.cpp (original)
+++ xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.cpp Tue Feb 26 
11:17:27 2008
@@ -56,6 +56,7 @@
 #include <xercesc/util/OutOfMemoryException.hpp>
 #include <xercesc/util/XMLEntityResolver.hpp>
 #include <xercesc/util/XMLUri.hpp>
+#include <xercesc/util/PSVIUni.hpp>
 #include <xercesc/framework/psvi/XSAnnotation.hpp>
 #include <xercesc/framework/MemBufInputSource.hpp>
 #include <xercesc/internal/XSAXMLScanner.hpp>
@@ -1215,16 +1216,11 @@
                           SchemaSymbols::fgELT_SIMPLETYPE);
         return 0;
     }
-
-    // -------------------------------------------------------------------
-    // Check attributes
-    // -------------------------------------------------------------------
-    unsigned short scope = (topLevel) ? 
GeneralAttributeCheck::E_SimpleTypeGlobal
-                                      : 
GeneralAttributeCheck::E_SimpleTypeLocal;
-
-    fAttributeCheck.checkAttributes(
-        childElem, scope, this, topLevel, fNonXSAttList
-    );
+    else if(!topLevel && !nameEmpty) {
+        reportSchemaError(childElem, XMLUni::fgXMLErrDomain, 
XMLErrs::AttributeDisallowed, 
+                          SchemaSymbols::fgATT_NAME, PSVIUni::fgLocal, 
childElem->getLocalName());
+        return 0;
+    }
 
     if (nameEmpty) { // anonymous simpleType
         name = genAnonTypeName(fgAnonSNamePrefix);
@@ -1247,6 +1243,16 @@
     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)) {



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

Reply via email to