xerces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amass...@apache.org
Subject svn commit: r804213 - /xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.cpp
Date Fri, 14 Aug 2009 13:19:16 GMT
Author: amassari
Date: Fri Aug 14 13:19:15 2009
New Revision: 804213

URL: http://svn.apache.org/viewvc?rev=804213&view=rev
Log:
When storing a default/fixed value, use the canonical representation

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=804213&r1=804212&r2=804213&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.cpp (original)
+++ xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.cpp Fri Aug 14 13:19:15 2009
@@ -8782,11 +8782,32 @@
 
         try
         {
-            validator->validate(valConstraint,0,fMemoryManager);
+            const XMLCh* valueToCheck = valConstraint;
+            short wsFacet = validator->getWSFacet();
+            if((wsFacet == DatatypeValidator::REPLACE && !XMLString::isWSReplaced(valueToCheck))
||
+               (wsFacet == DatatypeValidator::COLLAPSE && !XMLString::isWSCollapsed(valueToCheck)))
+            {
+                XMLCh* normalizedValue=XMLString::replicate(valueToCheck, fMemoryManager);
+                ArrayJanitor<XMLCh> tempURIName(normalizedValue, fMemoryManager);
+                if(wsFacet == DatatypeValidator::REPLACE)
+                    XMLString::replaceWS(normalizedValue, fMemoryManager);
+                else if(wsFacet == DatatypeValidator::COLLAPSE)
+                    XMLString::collapseWS(normalizedValue, fMemoryManager);
+                valueToCheck=fStringPool->getValueForId(fStringPool->addOrFind(normalizedValue));
+            }
 
-            XMLCh* canonical = (XMLCh*) validator->getCanonicalRepresentation(valConstraint,
fMemoryManager);
+            validator->validate(valueToCheck,0,fMemoryManager);
+
+            XMLCh* canonical = (XMLCh*) validator->getCanonicalRepresentation(valueToCheck,
fMemoryManager);
             ArrayJanitor<XMLCh> tempCanonical(canonical, fMemoryManager);
-            validator->validate(canonical, 0, fMemoryManager);
+
+            if(!XMLString::equals(canonical, valueToCheck))
+            {
+                validator->validate(canonical, 0, fMemoryManager);
+                valueToCheck=fStringPool->getValueForId(fStringPool->addOrFind(canonical));
+            }
+
+            elemDecl->setDefaultValue(valueToCheck);
 
             isValid = true;
         }



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


Mime
View raw message