You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by am...@apache.org on 2013/08/26 12:33:27 UTC

svn commit: r1517488 [1/3] - in /xerces/c/trunk: projects/Win32/VC10/xerces-all/ src/xercesc/internal/ src/xercesc/util/ src/xercesc/validators/DTD/ tests/src/XSTSHarness/

Author: amassari
Date: Mon Aug 26 10:33:26 2013
New Revision: 1517488

URL: http://svn.apache.org/r1517488
Log:
Add support for XML 1.0 5th edition (XERCESC-2016)

Modified:
    xerces/c/trunk/projects/Win32/VC10/xerces-all/   (props changed)
    xerces/c/trunk/src/xercesc/internal/CharTypeTables.hpp
    xerces/c/trunk/src/xercesc/internal/DGXMLScanner.cpp
    xerces/c/trunk/src/xercesc/internal/IGXMLScanner2.cpp
    xerces/c/trunk/src/xercesc/internal/SGXMLScanner.cpp
    xerces/c/trunk/src/xercesc/internal/XMLReader.cpp
    xerces/c/trunk/src/xercesc/internal/XMLScanner.cpp
    xerces/c/trunk/src/xercesc/util/XMLChar.cpp
    xerces/c/trunk/src/xercesc/util/XMLChar.hpp
    xerces/c/trunk/src/xercesc/util/XMLUni.cpp
    xerces/c/trunk/src/xercesc/util/XMLUni.hpp
    xerces/c/trunk/src/xercesc/validators/DTD/DTDValidator.cpp
    xerces/c/trunk/tests/src/XSTSHarness/XMLHarnessHandlers.cpp

Propchange: xerces/c/trunk/projects/Win32/VC10/xerces-all/
------------------------------------------------------------------------------
--- svn:global-ignores (added)
+++ svn:global-ignores Mon Aug 26 10:33:26 2013
@@ -0,0 +1 @@
+ipch

Propchange: xerces/c/trunk/projects/Win32/VC10/xerces-all/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Mon Aug 26 10:33:26 2013
@@ -1,2 +1,3 @@
 *.sdf
 *.suo
+*.opensdf

Modified: xerces/c/trunk/src/xercesc/internal/CharTypeTables.hpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/internal/CharTypeTables.hpp?rev=1517488&r1=1517487&r2=1517488&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/internal/CharTypeTables.hpp (original)
+++ xerces/c/trunk/src/xercesc/internal/CharTypeTables.hpp Mon Aug 26 10:33:26 2013
@@ -201,7 +201,7 @@ static const XMLCh gWhitespaceChars1_1[]
     ,   0x00
 };
 
-static const XMLCh gFirstNameChars1_1[] =
+static const XMLCh gFirstNameChars[] =
 {
     // Ranges
     // Note: 0x10000 to 0xEFFFF are also allowed, need to separately check
@@ -211,12 +211,13 @@ static const XMLCh gFirstNameChars1_1[] 
     ,   0xFDF0, 0xFFFD
     ,   0x00
 
+    //  :       _
     ,   0x003A, 0x005F
     ,   0x00
 
 };
 
-static const XMLCh gNameChars1_1[] =
+static const XMLCh gNameChars[] =
 {
     // Ranges
     // Note: 0x10000 to 0xEFFFF are also allowed, need to separately check
@@ -226,6 +227,7 @@ static const XMLCh gNameChars1_1[] =
     ,   0xF900, 0xFDCF, 0xFDF0, 0xFFFD
     ,   0x00
 
+    //  -       .       :       _
     ,   0x002D, 0x002E, 0x003A, 0x005F, 0x00B7
     ,   0x00
 };

Modified: xerces/c/trunk/src/xercesc/internal/DGXMLScanner.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/internal/DGXMLScanner.cpp?rev=1517488&r1=1517487&r2=1517488&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/internal/DGXMLScanner.cpp (original)
+++ xerces/c/trunk/src/xercesc/internal/DGXMLScanner.cpp Mon Aug 26 10:33:26 2013
@@ -2790,10 +2790,16 @@ bool DGXMLScanner::scanAttValue(  const 
     //  quotes until we hit the same reader again.
     const XMLSize_t curReader = fReaderMgr.getCurrentReaderNum();
 
-    // Get attribute def - to check to see if it's declared externally or not
-    bool  isAttExternal = (attDef)
-                        ?attDef->isExternal()
-                        :false;
+    // check to see if it's a tokenized type that is declared externally 
+    bool  isAttTokenizedExternal = (attDef)
+                                   ?attDef->isExternal() && (type == XMLAttDef::ID || 
+                                                             type == XMLAttDef::IDRef || 
+                                                             type == XMLAttDef::IDRefs || 
+                                                             type == XMLAttDef::Entity || 
+                                                             type == XMLAttDef::Entities || 
+                                                             type == XMLAttDef::NmToken || 
+                                                             type == XMLAttDef::NmTokens)
+                                   :false;
 
     //  Loop until we get the attribute value. Note that we use a double
     //  loop here to avoid the setup/teardown overhead of the exception
@@ -2908,7 +2914,7 @@ bool DGXMLScanner::scanAttValue(  const 
                     {
                         // Check Validity Constraint for Standalone document declaration
                         // XML 1.0, Section 2.9
-                        if (fStandalone && fValidate && isAttExternal)
+                        if (fStandalone && fValidate && isAttTokenizedExternal)
                         {
                              // Can't have a standalone document declaration of "yes" if  attribute
                              // values are subject to normalisation
@@ -2943,9 +2949,9 @@ bool DGXMLScanner::scanAttValue(  const 
 
                         // Check Validity Constraint for Standalone document declaration
                         // XML 1.0, Section 2.9
-                        if (fStandalone && fValidate && isAttExternal)
+                        if (fStandalone && fValidate && isAttTokenizedExternal)
                         {
-                            if (!firstNonWS || (nextCh != chSpace) || (fReaderMgr.lookingAtSpace()))
+                            if (!firstNonWS || (nextCh != chSpace && fReaderMgr.lookingAtSpace()))
                             {
                                  // Can't have a standalone document declaration of "yes" if  attribute
                                  // values are subject to normalisation

Modified: xerces/c/trunk/src/xercesc/internal/IGXMLScanner2.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/internal/IGXMLScanner2.cpp?rev=1517488&r1=1517487&r2=1517488&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/internal/IGXMLScanner2.cpp (original)
+++ xerces/c/trunk/src/xercesc/internal/IGXMLScanner2.cpp Mon Aug 26 10:33:26 2013
@@ -975,6 +975,17 @@ bool IGXMLScanner::normalizeAttValue( co
     // Get the type and name
     const XMLAttDef::AttTypes type = (attDef)?attDef->getType():XMLAttDef::CData;
 
+    // check to see if it's a tokenized type that is declared externally 
+    bool  isAttTokenizedExternal = (attDef)
+                                   ?attDef->isExternal() && (type == XMLAttDef::ID || 
+                                                             type == XMLAttDef::IDRef || 
+                                                             type == XMLAttDef::IDRefs || 
+                                                             type == XMLAttDef::Entity || 
+                                                             type == XMLAttDef::Entities || 
+                                                             type == XMLAttDef::NmToken || 
+                                                             type == XMLAttDef::NmTokens)
+                                   :false;
+
     // Assume its going to go fine, and empty the target buffer in preperation
     bool retVal = true;
     toFill.reset();
@@ -1001,7 +1012,7 @@ bool IGXMLScanner::normalizeAttValue( co
             case 0x0D:
                 // Check Validity Constraint for Standalone document declaration
                 // XML 1.0, Section 2.9
-                if (fStandalone && fValidate && attDef && attDef->isExternal())
+                if (fStandalone && fValidate && isAttTokenizedExternal)
                 {
                      // Can't have a standalone document declaration of "yes" if  attribute
                      // values are subject to normalisation
@@ -1065,9 +1076,9 @@ bool IGXMLScanner::normalizeAttValue( co
 
                     // Check Validity Constraint for Standalone document declaration
                     // XML 1.0, Section 2.9
-                    if (fStandalone && fValidate && attDef && attDef->isExternal())
+                    if (fStandalone && fValidate && isAttTokenizedExternal)
                     {
-                        if (!firstNonWS || (nextCh != chSpace) || (!*srcPtr) || fReaderMgr.getCurrentReader()->isWhitespace(*srcPtr))
+                        if (!firstNonWS || (nextCh != chSpace && *srcPtr && fReaderMgr.getCurrentReader()->isWhitespace(*srcPtr)))
                         {
                             // Can't have a standalone document declaration of "yes" if  attribute
                             // values are subject to normalisation
@@ -2417,10 +2428,16 @@ bool IGXMLScanner::scanAttValue(  const 
     //  quotes until we hit the same reader again.
     const XMLSize_t curReader = fReaderMgr.getCurrentReaderNum();
 
-    // Get attribute def - to check to see if it's declared externally or not
-    bool  isAttExternal = (attDef)
-                ?attDef->isExternal()
-                :false;
+    // check to see if it's a tokenized type that is declared externally 
+    bool  isAttTokenizedExternal = (attDef)
+                                   ?attDef->isExternal() && (type == XMLAttDef::ID || 
+                                                             type == XMLAttDef::IDRef || 
+                                                             type == XMLAttDef::IDRefs || 
+                                                             type == XMLAttDef::Entity || 
+                                                             type == XMLAttDef::Entities || 
+                                                             type == XMLAttDef::NmToken || 
+                                                             type == XMLAttDef::NmTokens)
+                                   :false;
 
     //  Loop until we get the attribute value. Note that we use a double
     //  loop here to avoid the setup/teardown overhead of the exception
@@ -2535,7 +2552,7 @@ bool IGXMLScanner::scanAttValue(  const 
                         {
                             // Check Validity Constraint for Standalone document declaration
                             // XML 1.0, Section 2.9
-                            if (fStandalone && fValidate && isAttExternal)
+                            if (fStandalone && fValidate && isAttTokenizedExternal)
                             {
                                 // Can't have a standalone document declaration of "yes" if  attribute
                                 // values are subject to normalisation
@@ -2570,9 +2587,9 @@ bool IGXMLScanner::scanAttValue(  const 
 
                             // Check Validity Constraint for Standalone document declaration
                             // XML 1.0, Section 2.9
-                            if (fStandalone && fValidate && isAttExternal)
+                            if (fStandalone && fValidate && isAttTokenizedExternal)
                             {
-                                if (!firstNonWS || (nextCh != chSpace) || (fReaderMgr.lookingAtSpace()))
+                                if (!firstNonWS || (nextCh != chSpace && fReaderMgr.lookingAtSpace()))
                                 {
                                      // Can't have a standalone document declaration of "yes" if  attribute
                                      // values are subject to normalisation

Modified: xerces/c/trunk/src/xercesc/internal/SGXMLScanner.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/internal/SGXMLScanner.cpp?rev=1517488&r1=1517487&r2=1517488&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/internal/SGXMLScanner.cpp (original)
+++ xerces/c/trunk/src/xercesc/internal/SGXMLScanner.cpp Mon Aug 26 10:33:26 2013
@@ -2870,10 +2870,16 @@ bool SGXMLScanner::normalizeAttValue( co
     bool retVal = true;
     toFill.reset();
 
-    // Get attribute def - to check to see if it's declared externally or not
-    bool  isAttExternal = (attDef)
-                        ?attDef->isExternal()
-                        :false;
+    // check to see if it's a tokenized type that is declared externally 
+    bool  isAttTokenizedExternal = (attDef)
+                                   ?attDef->isExternal() && (type == XMLAttDef::ID || 
+                                                             type == XMLAttDef::IDRef || 
+                                                             type == XMLAttDef::IDRefs || 
+                                                             type == XMLAttDef::Entity || 
+                                                             type == XMLAttDef::Entities || 
+                                                             type == XMLAttDef::NmToken || 
+                                                             type == XMLAttDef::NmTokens)
+                                   :false;
 
     //  Loop through the chars of the source value and normalize it according
     //  to the type.
@@ -2897,7 +2903,7 @@ bool SGXMLScanner::normalizeAttValue( co
             else if ( (nextCh <= 0x0D) && (nextCh == 0x09 || nextCh == 0x0A || nextCh == 0x0D) ) {
                 // Check Validity Constraint for Standalone document declaration
                 // XML 1.0, Section 2.9
-                if (fStandalone && fValidate && isAttExternal)
+                if (fStandalone && fValidate && isAttTokenizedExternal)
                 {
                      // Can't have a standalone document declaration of "yes" if  attribute
                      // values are subject to normalisation
@@ -2963,9 +2969,9 @@ bool SGXMLScanner::normalizeAttValue( co
 
                     // Check Validity Constraint for Standalone document declaration
                     // XML 1.0, Section 2.9
-                    if (fStandalone && fValidate && isAttExternal)
+                    if (fStandalone && fValidate && isAttTokenizedExternal)
                     {
-                        if (!firstNonWS || (nextCh != chSpace) || (!*srcPtr) || fReaderMgr.getCurrentReader()->isWhitespace(*srcPtr))
+                        if (!firstNonWS || (nextCh != chSpace && *srcPtr && fReaderMgr.getCurrentReader()->isWhitespace(*srcPtr)))
                         {
                             // Can't have a standalone document declaration of "yes" if  attribute
                             // values are subject to normalisation

Modified: xerces/c/trunk/src/xercesc/internal/XMLReader.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/internal/XMLReader.cpp?rev=1517488&r1=1517487&r2=1517488&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/internal/XMLReader.cpp (original)
+++ xerces/c/trunk/src/xercesc/internal/XMLReader.cpp Mon Aug 26 10:33:26 2013
@@ -645,7 +645,7 @@ bool XMLReader::getName(XMLBuffer& toFil
     //  if its a name and not a name token that they want.
     if (!token)
     {
-        if (fXMLVersion == XMLV1_1 && ((fCharBuf[fCharIndex] >= 0xD800) && (fCharBuf[fCharIndex] <= 0xDB7F))) {
+        if ((fCharBuf[fCharIndex] >= 0xD800) && (fCharBuf[fCharIndex] <= 0xDB7F)) {
            // make sure one more char is in the buffer, the transcoder
            // should put only a complete surrogate pair into the buffer
            assert(fCharIndex+1 < fCharsAvail);
@@ -669,34 +669,22 @@ bool XMLReader::getName(XMLBuffer& toFil
     //  a non-name char.
     while (true)
     {
-        if (fXMLVersion == XMLV1_1)
+        while (fCharIndex < fCharsAvail)
         {
-            while (fCharIndex < fCharsAvail)
+            //  Check the current char and take it if its a name char. Else
+            //  break out.
+            if ( (fCharBuf[fCharIndex] >= 0xD800) && (fCharBuf[fCharIndex] <= 0xDB7F) )
             {
-                //  Check the current char and take it if its a name char. Else
-                //  break out.
-                if ( (fCharBuf[fCharIndex] >= 0xD800) && (fCharBuf[fCharIndex] <= 0xDB7F) )
-                {
-                    // make sure one more char is in the buffer, the transcoder
-                    // should put only a complete surrogate pair into the buffer
-                    assert(fCharIndex+1 < fCharsAvail);
-                    if ( (fCharBuf[fCharIndex+1] < 0xDC00) ||
-                         (fCharBuf[fCharIndex+1] > 0xDFFF)  )
-                        break;
-                    fCharIndex += 2;
+                // make sure one more char is in the buffer, the transcoder
+                // should put only a complete surrogate pair into the buffer
+                assert(fCharIndex+1 < fCharsAvail);
+                if ( (fCharBuf[fCharIndex+1] < 0xDC00) ||
+                        (fCharBuf[fCharIndex+1] > 0xDFFF)  )
+                    break;
+                fCharIndex += 2;
 
-                }
-                else
-                {
-                    if (!isNameChar(fCharBuf[fCharIndex]))
-                        break;
-                    fCharIndex++;
-                }
             }
-        }
-        else // XMLV1_0
-        {
-            while (fCharIndex < fCharsAvail)
+            else
             {
                 if (!isNameChar(fCharBuf[fCharIndex]))
                     break;
@@ -732,8 +720,7 @@ bool XMLReader::getNCName(XMLBuffer& toF
     //  Lets check the first char for being a first name char. If not, then
     //  what's the point in living mannnn? Just give up now. We only do this
     //  if its a name and not a name token that they want.
-    if (fXMLVersion == XMLV1_1
-        && ((fCharBuf[fCharIndex] >= 0xD800) && (fCharBuf[fCharIndex] <= 0xDB7F))) {
+    if ((fCharBuf[fCharIndex] >= 0xD800) && (fCharBuf[fCharIndex] <= 0xDB7F)) {
         // make sure one more char is in the buffer, the transcoder
         // should put only a complete surrogate pair into the buffer
         assert(fCharIndex+1 < fCharsAvail);
@@ -769,17 +756,12 @@ bool XMLReader::getNCName(XMLBuffer& toF
         }
 
         //  Check the current char and take it if it's a name char
-        if (fXMLVersion == XMLV1_1)
+        while(fCharIndex < fCharsAvail)
         {
-            while(fCharIndex < fCharsAvail)
-            {
-                if(isNCNameChar(fCharBuf[fCharIndex])) fCharIndex++;
-                else if((fCharBuf[fCharIndex] >= 0xD800) && (fCharBuf[fCharIndex] <= 0xDB7F) && ((fCharBuf[fCharIndex+1] < 0xDC00) || (fCharBuf[fCharIndex+1] > 0xDFFF))) fCharIndex+=2;
-		else break;
-            }
+            if((fCharBuf[fCharIndex] >= 0xD800) && (fCharBuf[fCharIndex] <= 0xDB7F) && fCharIndex+1 < fCharsAvail && ((fCharBuf[fCharIndex+1] < 0xDC00) || (fCharBuf[fCharIndex+1] > 0xDFFF))) fCharIndex+=2;
+            else if(isNCNameChar(fCharBuf[fCharIndex])) fCharIndex++;
+            else break;
         }
-        else
-            while(fCharIndex < fCharsAvail && isNCNameChar(fCharBuf[fCharIndex])) fCharIndex++;
         // if we didn't consume the entire buffer, we are done
     } while(fCharIndex == fCharsAvail);
 

Modified: xerces/c/trunk/src/xercesc/internal/XMLScanner.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/internal/XMLScanner.cpp?rev=1517488&r1=1517487&r2=1517488&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/internal/XMLScanner.cpp (original)
+++ xerces/c/trunk/src/xercesc/internal/XMLScanner.cpp Mon Aug 26 10:33:26 2013
@@ -1438,17 +1438,23 @@ void XMLScanner::scanXMLDecl(const DeclT
         {
             if (XMLString::equals(rawValue, XMLUni::fgVersion1_1)) {
                 if (type == Decl_XML) {
-                	fXMLVersion = XMLReader::XMLV1_1;
+                    fXMLVersion = XMLReader::XMLV1_1;
                     fReaderMgr.setXMLVersion(XMLReader::XMLV1_1);
                 }
                 else {
-            	    if (fXMLVersion != XMLReader::XMLV1_1)
-            	        emitError(XMLErrs::UnsupportedXMLVersion, rawValue);
-            	}
+                    if (fXMLVersion != XMLReader::XMLV1_1)
+                        emitError(XMLErrs::UnsupportedXMLVersion, rawValue);
+                }
             }
             else if (XMLString::equals(rawValue, XMLUni::fgVersion1_0)) {
                 if (type == Decl_XML) {
-                	fXMLVersion = XMLReader::XMLV1_0;
+                    fXMLVersion = XMLReader::XMLV1_0;
+                    fReaderMgr.setXMLVersion(XMLReader::XMLV1_0);
+                }
+            }
+            else if (XMLString::startsWith(rawValue, XMLUni::fgVersion1)) {
+                if (type == Decl_XML) {
+                    fXMLVersion = XMLReader::XMLV1_0;
                     fReaderMgr.setXMLVersion(XMLReader::XMLV1_0);
                 }
             }



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