diff --git a/src/xercesc/framework/XMLFormatter.cpp b/src/xercesc/framework/XMLFormatter.cpp
index 70d86669e56a2ca160de8ad5a766cf85fe4e73b4..d4b19373d82f4099e76186e16a527ef03b6c736a 100644
--- a/src/xercesc/framework/XMLFormatter.cpp
+++ b/src/xercesc/framework/XMLFormatter.cpp
@@ -582,13 +582,13 @@ void XMLFormatter::writeCharRef(const XMLCh &toWrite)
 
 void XMLFormatter::writeCharRef(XMLSize_t toWrite)
 {
-    XMLCh tmpBuf[32];
+    XMLCh tmpBuf[64];
     tmpBuf[0] = chAmpersand;
     tmpBuf[1] = chPound;
     tmpBuf[2] = chLatin_x;
 
     // Build a char ref for the current char
-    XMLString::binToText(toWrite, &tmpBuf[3], 8, 16, fMemoryManager);
+    XMLString::sizeToText(toWrite, &tmpBuf[3], 32, 16, fMemoryManager);
     const XMLSize_t bufLen = XMLString::stringLen(tmpBuf);
     tmpBuf[bufLen] = chSemiColon;
     tmpBuf[bufLen+1] = chNull;
diff --git a/src/xercesc/internal/DGXMLScanner.cpp b/src/xercesc/internal/DGXMLScanner.cpp
index d6bdd1cfddafe33d71b42bf98b22fe41e72a9116..0ad28483621b1fcbd219540f6b4b1f3b5c19c735 100644
--- a/src/xercesc/internal/DGXMLScanner.cpp
+++ b/src/xercesc/internal/DGXMLScanner.cpp
@@ -3572,8 +3572,8 @@ DGXMLScanner::scanEntityRef(  const   bool    inAttVal
         // here's where we need to check if there's a SecurityManager,
         // how many entity references we've had
         if(fSecurityManager != 0 && ++fEntityExpansionCount > fEntityExpansionLimit) {
-            XMLCh expLimStr[16];
-            XMLString::binToText(fEntityExpansionLimit, expLimStr, 15, 10, fMemoryManager);
+            XMLCh expLimStr[32];
+            XMLString::sizeToText(fEntityExpansionLimit, expLimStr, 31, 10, fMemoryManager);
             emitError
             (
                 XMLErrs::EntityExpansionLimitExceeded
@@ -3630,8 +3630,8 @@ DGXMLScanner::scanEntityRef(  const   bool    inAttVal
         // here's where we need to check if there's a SecurityManager,
         // how many entity references we've had
         if(fSecurityManager != 0 && ++fEntityExpansionCount > fEntityExpansionLimit) {
-            XMLCh expLimStr[16];
-            XMLString::binToText(fEntityExpansionLimit, expLimStr, 15, 10, fMemoryManager);
+            XMLCh expLimStr[32];
+            XMLString::sizeToText(fEntityExpansionLimit, expLimStr, 31, 10, fMemoryManager);
             emitError
             (
                 XMLErrs::EntityExpansionLimitExceeded
diff --git a/src/xercesc/internal/IGXMLScanner2.cpp b/src/xercesc/internal/IGXMLScanner2.cpp
index 09ad0bbf32bef90b972023df8cddda1ae0d6e4b1..7c34a4ed45417ea255e8190d0f4472a90bb7af52 100644
--- a/src/xercesc/internal/IGXMLScanner2.cpp
+++ b/src/xercesc/internal/IGXMLScanner2.cpp
@@ -3080,8 +3080,8 @@ IGXMLScanner::scanEntityRef(  const   bool    inAttVal
         // here's where we need to check if there's a SecurityManager,
         // how many entity references we've had
         if(fSecurityManager != 0 && ++fEntityExpansionCount > fEntityExpansionLimit) {
-            XMLCh expLimStr[16];
-            XMLString::binToText(fEntityExpansionLimit, expLimStr, 15, 10, fMemoryManager);
+            XMLCh expLimStr[32];
+            XMLString::sizeToText(fEntityExpansionLimit, expLimStr, 31, 10, fMemoryManager);
             emitError
             (
                 XMLErrs::EntityExpansionLimitExceeded
@@ -3138,8 +3138,8 @@ IGXMLScanner::scanEntityRef(  const   bool    inAttVal
         // here's where we need to check if there's a SecurityManager,
         // how many entity references we've had
         if(fSecurityManager != 0 && ++fEntityExpansionCount > fEntityExpansionLimit) {
-            XMLCh expLimStr[16];
-            XMLString::binToText(fEntityExpansionLimit, expLimStr, 15, 10, fMemoryManager);
+            XMLCh expLimStr[32];
+            XMLString::sizeToText(fEntityExpansionLimit, expLimStr, 31, 10, fMemoryManager);
             emitError
             (
                 XMLErrs::EntityExpansionLimitExceeded
diff --git a/src/xercesc/internal/SGXMLScanner.cpp b/src/xercesc/internal/SGXMLScanner.cpp
index f9cedfde7d79e600e98fc66f88de351de2a07a6e..067fd916c369e78f7a38c9746a06b198a563b1ca 100644
--- a/src/xercesc/internal/SGXMLScanner.cpp
+++ b/src/xercesc/internal/SGXMLScanner.cpp
@@ -4626,8 +4626,8 @@ SGXMLScanner::scanEntityRef(  const   bool
     // here's where we need to check if there's a SecurityManager,
     // how many entity references we've had
     if(fSecurityManager != 0 && ++fEntityExpansionCount > fEntityExpansionLimit) {
-        XMLCh expLimStr[16];
-        XMLString::binToText(fEntityExpansionLimit, expLimStr, 15, 10, fMemoryManager);
+        XMLCh expLimStr[32];
+        XMLString::sizeToText(fEntityExpansionLimit, expLimStr, 31, 10, fMemoryManager);
         emitError
         (
             XMLErrs::EntityExpansionLimitExceeded
diff --git a/src/xercesc/internal/WFXMLScanner.cpp b/src/xercesc/internal/WFXMLScanner.cpp
index 8670eb531430a264b3871ed411e7c4f0711a26a9..b1d542ffb74c9fb5202d121aad02ad15d7bfa07e 100644
--- a/src/xercesc/internal/WFXMLScanner.cpp
+++ b/src/xercesc/internal/WFXMLScanner.cpp
@@ -2116,8 +2116,8 @@ WFXMLScanner::scanEntityRef(const bool
     // here's where we need to check if there's a SecurityManager,
     // how many entity references we've had
     if(fSecurityManager != 0 && ++fEntityExpansionCount > fEntityExpansionLimit) {
-        XMLCh expLimStr[16];
-        XMLString::binToText(fEntityExpansionLimit, expLimStr, 15, 10, fMemoryManager);
+        XMLCh expLimStr[32];
+        XMLString::sizeToText(fEntityExpansionLimit, expLimStr, 31, 10, fMemoryManager);
         emitError
         ( 
             XMLErrs::EntityExpansionLimitExceeded
diff --git a/src/xercesc/internal/XSerializeEngine.cpp b/src/xercesc/internal/XSerializeEngine.cpp
index 506880fc36033bd13dabcb16fe6b06c8be1049be..3c708a29064a8ba3e57df24bee7c04b37fade8e8 100644
--- a/src/xercesc/internal/XSerializeEngine.cpp
+++ b/src/xercesc/internal/XSerializeEngine.cpp
@@ -835,7 +835,7 @@ XSerializable* XSerializeEngine::lookupLoadPool(XSerializedObjectId_t objectTag)
       ***/
     TEST_THROW_ARG2( (objectTag > fLoadPool->size())
               , objectTag
-              , fLoadPool->size()
+              , (unsigned long)fLoadPool->size() // @@ Need to use sizeToText directly.
               , XMLExcepts::XSer_LoadPool_UppBnd_Exceed
               )
 
@@ -853,7 +853,7 @@ void XSerializeEngine::addLoadPool(void* const objToAdd)
 
     TEST_THROW_ARG2( (fLoadPool->size() != fObjectCount)
                , fObjectCount
-               , fLoadPool->size()
+               , (unsigned long)fLoadPool->size() // @@ Need to use sizeToText directly.
                , XMLExcepts::XSer_LoadPool_NoTally_ObjCnt
                )
 
@@ -899,16 +899,16 @@ void XSerializeEngine::fillBuffer()
     /***
      * InputStream MUST fill in the exact amount of bytes as requested
      * to do: combine the checking and create a new exception code later
-     ***/
+    ***/
     TEST_THROW_ARG2( (bytesRead < fBufSize)
-               , (unsigned long)bytesRead
-               , (unsigned long)fBufSize
+               , (unsigned long)bytesRead // @@ Need to use sizeToText directly.
+               , (unsigned long)fBufSize  // @@ Need to use sizeToText directly.
                , XMLExcepts::XSer_InStream_Read_LT_Req
                )
 
     TEST_THROW_ARG2( (bytesRead > fBufSize)
-               , (unsigned long)bytesRead
-               , (unsigned long)fBufSize
+               , (unsigned long)bytesRead // @@ Need to use sizeToText directly.
+               , (unsigned long)fBufSize  // @@ Need to use sizeToText directly.
                , XMLExcepts::XSer_InStream_Read_OverFlow
                )
 
@@ -943,7 +943,7 @@ void XSerializeEngine::flushBuffer()
 inline void XSerializeEngine::checkAndFlushBuffer(XMLSize_t bytesNeedToWrite)
 {
     TEST_THROW_ARG1( (bytesNeedToWrite <= 0)
-                   , (unsigned long)bytesNeedToWrite
+                   , (unsigned long)bytesNeedToWrite // @@ Need to use sizeToText directly.
                    , XMLExcepts::XSer_Inv_checkFlushBuffer_Size
                    )
 
@@ -956,7 +956,7 @@ inline void XSerializeEngine::checkAndFillBuffer(XMLSize_t bytesNeedToRead)
 {
 
     TEST_THROW_ARG1( (bytesNeedToRead <= 0)
-                   , (unsigned long)bytesNeedToRead
+                   , (unsigned long)bytesNeedToRead // @@ Need to use sizeToText directly.
                    , XMLExcepts::XSer_Inv_checkFillBuffer_Size
                    )
 
@@ -972,8 +972,8 @@ inline void XSerializeEngine::ensureStoreBuffer() const
 {
 
     TEST_THROW_ARG2 ( !((fBufStart <= fBufCur) && (fBufCur <= fBufEnd))
-                    , (unsigned long)(fBufCur - fBufStart)
-                    , (unsigned long)(fBufEnd - fBufCur)
+                    , (unsigned long)(fBufCur - fBufStart) // @@ Need to use sizeToText directly.
+                    , (unsigned long)(fBufEnd - fBufCur)   // @@ Need to use sizeToText directly.
                     , XMLExcepts::XSer_StoreBuffer_Violation
                     )
 
diff --git a/src/xercesc/util/XMLString.cpp b/src/xercesc/util/XMLString.cpp
index 56ec13ccb24b6e14a1345680e91f39548e282e03..6b8251df44740493ac58cbe4c7dfa4f3224ce4fc 100644
--- a/src/xercesc/util/XMLString.cpp
+++ b/src/xercesc/util/XMLString.cpp
@@ -80,6 +80,22 @@ MemoryManager* XMLString::fgMemoryManager = 0;
 // ---------------------------------------------------------------------------
 //  XMLString: Public static methods
 // ---------------------------------------------------------------------------
+
+void XMLString::sizeToText(  const   XMLSize_t           toFormat
+                            ,       char* const          toFill
+                            , const XMLSize_t            maxChars
+                            , const unsigned int         radix
+                            , MemoryManager* const       manager)
+{
+#if XERCES_SIZEOF_INT != 8 && XERCES_SIZEOF_LONG != 8 && XERCES_SIZEOF_INT64 != 4
+    // Call the int 64-bit version.
+    binToText((XMLUInt64)toFormat, toFill, maxChars, radix, manager);
+#else
+    // Call the unsigned long version.
+    binToText((unsigned long)toFormat, toFill, maxChars, radix, manager);
+#endif
+}
+
 #if XERCES_SIZEOF_INT != 8 && XERCES_SIZEOF_LONG != 8 && XERCES_SIZEOF_INT64 != 4
 void XMLString::binToText(  const   XMLUInt64            toFormat
                             ,       char* const          toFill
@@ -837,6 +853,22 @@ bool XMLString::isHex(XMLCh const theChar)
 // ---------------------------------------------------------------------------
 //  Wide char versions of most of the string methods
 // ---------------------------------------------------------------------------
+
+void XMLString::sizeToText(  const  XMLSize_t            toFormat
+                            ,       XMLCh* const         toFill
+                            , const XMLSize_t            maxChars
+                            , const unsigned int         radix
+                            , MemoryManager* const       manager)
+{
+#if XERCES_SIZEOF_INT != 8 && XERCES_SIZEOF_LONG != 8 && XERCES_SIZEOF_INT64 != 4
+    // Call the int 64-bit version.
+    binToText((XMLUInt64)toFormat, toFill, maxChars, radix, manager);
+#else
+    // Call the unsigned long version.
+    binToText((unsigned long)toFormat, toFill, maxChars, radix, manager);
+#endif
+}
+
 #if XERCES_SIZEOF_INT != 8 && XERCES_SIZEOF_LONG != 8 && XERCES_SIZEOF_INT64 != 4
 void XMLString::binToText(  const   XMLUInt64            toFormat
                             ,       XMLCh* const         toFill
diff --git a/src/xercesc/util/XMLString.hpp b/src/xercesc/util/XMLString.hpp
index f555796c1fa54b9b0154c2993b461f632f2ed6e9..dbd3a5b64cdc1d3eb71319e6a403dacdee41c613 100644
--- a/src/xercesc/util/XMLString.hpp
+++ b/src/xercesc/util/XMLString.hpp
@@ -901,6 +901,46 @@ public:
     /** @name Conversion functions */
     //@{
 
+      /** Converts size to a text string based a given radix
+      *
+      * @param toFormat The size to convert
+      * @param toFill The buffer that will hold the output on return. The
+      *        size of this buffer should at least be 'maxChars + 1'.
+      * @param maxChars The maximum number of output characters that can be
+      *         accepted. If the result will not fit, it is an error.
+      * @param radix The radix of the input data, based on which the conversion
+      * @param manager The MemoryManager to use to allocate objects
+      * will be done
+      */
+    static void sizeToText
+    (
+        const   XMLSize_t           toFormat
+        ,       char* const         toFill
+        , const XMLSize_t           maxChars
+        , const unsigned int        radix
+        , MemoryManager* const      manager = XMLPlatformUtils::fgMemoryManager
+    );
+
+    /** Converts size to a text string based a given radix
+      *
+      * @param toFormat The size to convert
+      * @param toFill The buffer that will hold the output on return. The
+      *        size of this buffer should at least be 'maxChars + 1'.
+      * @param maxChars The maximum number of output characters that can be
+      *         accepted. If the result will not fit, it is an error.
+      * @param radix The radix of the input data, based on which the conversion
+      * @param manager The MemoryManager to use to allocate objects
+      * will be done
+      */
+    static void sizeToText
+    (
+        const   XMLSize_t           toFormat
+        ,       XMLCh* const        toFill
+        , const XMLSize_t           maxChars
+        , const unsigned int        radix
+        , MemoryManager* const      manager = XMLPlatformUtils::fgMemoryManager
+    );
+
     /** Converts binary data to a text string based a given radix
       *
       * @param toFormat The number to convert
diff --git a/src/xercesc/util/regx/RegularExpression.cpp b/src/xercesc/util/regx/RegularExpression.cpp
index deadcc8bd5f8c9f0ca0605922fec1193b32aa1d2..b9552d967b8d804b213d7dae86f3db241079c0be 100644
--- a/src/xercesc/util/regx/RegularExpression.cpp
+++ b/src/xercesc/util/regx/RegularExpression.cpp
@@ -835,7 +835,7 @@ XMLCh* RegularExpression::replace(const XMLCh* const matchString,
         tokStart = match->getEndPos(0);
     }
 
-    if(end > tokStart)
+    if(end > (XMLSize_t)tokStart)
         result.append(matchString + tokStart, end - tokStart);
 
     return XMLString::replicate(result.getRawBuffer(), manager);
diff --git a/src/xercesc/validators/datatype/AbstractStringValidator.cpp b/src/xercesc/validators/datatype/AbstractStringValidator.cpp
index f3bb7541de41ea81f630e1cedff738eb3b9e3a9e..4f18ba643704563d46d5b49b6aa504813d09eb45 100644
--- a/src/xercesc/validators/datatype/AbstractStringValidator.cpp
+++ b/src/xercesc/validators/datatype/AbstractStringValidator.cpp
@@ -585,7 +585,7 @@ void AbstractStringValidator::checkContent( const XMLCh*             const conte
         return;
 
     checkValueSpace(content, manager);
-    int length = getLength(content, manager);
+    XMLSize_t length = getLength(content, manager);
 
     if (((thisFacetsDefined & DatatypeValidator::FACET_MAXLENGTH) != 0) &&
         (length > getMaxLength()))
@@ -713,10 +713,10 @@ void AbstractStringValidator::assignAdditionalFacet( const XMLCh* const key
             , manager);
 }
 
-int AbstractStringValidator::getLength(const XMLCh* const content
-                                   , MemoryManager* const) const
+XMLSize_t AbstractStringValidator::getLength(const XMLCh* const content
+                                           , MemoryManager* const) const
 {
-    return (int)XMLString::stringLen(content);
+    return XMLString::stringLen(content);
 }
 
 /***
diff --git a/src/xercesc/validators/datatype/AbstractStringValidator.hpp b/src/xercesc/validators/datatype/AbstractStringValidator.hpp
index 349a6d771f38cd685db37b58116f8b7d87463965..ff2b9d447437710d111310180876d0d7ffe8b7d8 100644
--- a/src/xercesc/validators/datatype/AbstractStringValidator.hpp
+++ b/src/xercesc/validators/datatype/AbstractStringValidator.hpp
@@ -110,7 +110,7 @@ protected:
     virtual void checkAdditionalFacet(const XMLCh* const content
                                     , MemoryManager* const manager) const;
 
-    virtual int getLength(const XMLCh* const content
+    virtual XMLSize_t getLength(const XMLCh* const content
         , MemoryManager* const manager) const;
     
     virtual void checkValueSpace(const XMLCh* const content
diff --git a/src/xercesc/validators/datatype/Base64BinaryDatatypeValidator.cpp b/src/xercesc/validators/datatype/Base64BinaryDatatypeValidator.cpp
index 229ca4c8bb8f7bcbb4bdceb63a2d49bf7c6afc06..7763eafce973f209915248f3cf6be4cd3b2ecd18 100644
--- a/src/xercesc/validators/datatype/Base64BinaryDatatypeValidator.cpp
+++ b/src/xercesc/validators/datatype/Base64BinaryDatatypeValidator.cpp
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -70,8 +70,9 @@ void Base64BinaryDatatypeValidator::checkValueSpace(const XMLCh* const content
 {
     if (!content || !*content)
         return;
-    if (getLength(content, manager) < 0)
-    { 
+
+    if (Base64::getDataLength(content, manager, Base64::Conf_Schema) < 0)
+    {
         ThrowXMLwithMemMgr1(InvalidDatatypeValueException
                 , XMLExcepts::VALUE_Not_Base64
                 , content
@@ -79,12 +80,13 @@ void Base64BinaryDatatypeValidator::checkValueSpace(const XMLCh* const content
     }
 }
 
-int Base64BinaryDatatypeValidator::getLength(const XMLCh* const content
+XMLSize_t Base64BinaryDatatypeValidator::getLength(const XMLCh* const content
                                          , MemoryManager* const manager) const
 {
     if (!content || !*content)
         return 0;
-    return Base64::getDataLength(content, manager, Base64::Conf_Schema);
+
+    return (XMLSize_t)Base64::getDataLength(content, manager, Base64::Conf_Schema);
 }
 
 void Base64BinaryDatatypeValidator::normalizeEnumeration(MemoryManager* const manager)
@@ -101,7 +103,7 @@ void Base64BinaryDatatypeValidator::normalizeEnumeration(MemoryManager* const ma
 void Base64BinaryDatatypeValidator::normalizeContent(XMLCh* const content
                                                      , MemoryManager* const manager) const
 {
-    XMLString::removeWS(content, manager);     
+    XMLString::removeWS(content, manager);
 }
 
 /***
diff --git a/src/xercesc/validators/datatype/Base64BinaryDatatypeValidator.hpp b/src/xercesc/validators/datatype/Base64BinaryDatatypeValidator.hpp
index 2877d7aa37996001fea456d6820f3f70867f828f..595084b75b1765d61687bd03603226ac6a836a44 100644
--- a/src/xercesc/validators/datatype/Base64BinaryDatatypeValidator.hpp
+++ b/src/xercesc/validators/datatype/Base64BinaryDatatypeValidator.hpp
@@ -74,7 +74,7 @@ protected:
     virtual void checkValueSpace(const XMLCh* const content
                             , MemoryManager* const manager);
 
-    virtual int  getLength(const XMLCh* const content
+    virtual XMLSize_t getLength(const XMLCh* const content
                        , MemoryManager* const manager) const;
 
     virtual void normalizeEnumeration(MemoryManager* const manager);
diff --git a/src/xercesc/validators/datatype/HexBinaryDatatypeValidator.cpp b/src/xercesc/validators/datatype/HexBinaryDatatypeValidator.cpp
index 918974ddc996847e909c287fa2ec0baff0e2103a..b95ff4b5232c573c9e7ac63ba978dddba537f666 100644
--- a/src/xercesc/validators/datatype/HexBinaryDatatypeValidator.cpp
+++ b/src/xercesc/validators/datatype/HexBinaryDatatypeValidator.cpp
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -65,10 +65,10 @@ DatatypeValidator* HexBinaryDatatypeValidator::newInstance
 //  Utilities
 // ---------------------------------------------------------------------------
 
-void HexBinaryDatatypeValidator::checkValueSpace(const XMLCh* const content
-                                                 , MemoryManager* const manager)
+void HexBinaryDatatypeValidator::checkValueSpace(const XMLCh* const content,
+                                                 MemoryManager* const manager)
 {
-    if (getLength(content, manager) < 0)
+    if (HexBin::getDataLength(content) < 0)
     {
         ThrowXMLwithMemMgr1(InvalidDatatypeValueException
                 , XMLExcepts::VALUE_Not_HexBin
@@ -77,10 +77,10 @@ void HexBinaryDatatypeValidator::checkValueSpace(const XMLCh* const content
     }
 }
 
-int HexBinaryDatatypeValidator::getLength(const XMLCh* const content
+XMLSize_t HexBinaryDatatypeValidator::getLength(const XMLCh* const content
                                       , MemoryManager* const) const
 {
-    return HexBin::getDataLength(content);
+    return (XMLSize_t)HexBin::getDataLength(content);
 }
 
 /***
diff --git a/src/xercesc/validators/datatype/HexBinaryDatatypeValidator.hpp b/src/xercesc/validators/datatype/HexBinaryDatatypeValidator.hpp
index 23050595d4c7cd99c6b2ecf4fb6871006882ddb8..b2815026d7ea7fad2d517488644d049cd036b620 100644
--- a/src/xercesc/validators/datatype/HexBinaryDatatypeValidator.hpp
+++ b/src/xercesc/validators/datatype/HexBinaryDatatypeValidator.hpp
@@ -75,7 +75,7 @@ protected:
     virtual void checkValueSpace(const XMLCh* const content
                                 , MemoryManager* const manager);
 
-    virtual int  getLength(const XMLCh* const content
+    virtual XMLSize_t  getLength(const XMLCh* const content
                        , MemoryManager* const manager) const;
 
 private:
diff --git a/src/xercesc/validators/datatype/ListDatatypeValidator.cpp b/src/xercesc/validators/datatype/ListDatatypeValidator.cpp
index a721e33dbad96bfe3eb239e5dbdd56be0db89e5f..1c92fe682acb44e1863de23672a0bb94e10c4496 100644
--- a/src/xercesc/validators/datatype/ListDatatypeValidator.cpp
+++ b/src/xercesc/validators/datatype/ListDatatypeValidator.cpp
@@ -175,8 +175,8 @@ void ListDatatypeValidator::checkContent(       BaseRefVectorOf<XMLCh>*       to
     {
         XMLCh value1[BUF_LEN+1];
         XMLCh value2[BUF_LEN+1];
-        XMLString::binToText(tokenNumber, value1, BUF_LEN, 10, manager);
-        XMLString::binToText(getMaxLength(), value2, BUF_LEN, 10, manager);
+        XMLString::sizeToText(tokenNumber, value1, BUF_LEN, 10, manager);
+        XMLString::sizeToText(getMaxLength(), value2, BUF_LEN, 10, manager);
 
         ThrowXMLwithMemMgr3(InvalidDatatypeValueException
                 , XMLExcepts::VALUE_GT_maxLen
@@ -191,8 +191,8 @@ void ListDatatypeValidator::checkContent(       BaseRefVectorOf<XMLCh>*       to
     {
         XMLCh value1[BUF_LEN+1];
         XMLCh value2[BUF_LEN+1];
-        XMLString::binToText(tokenNumber, value1, BUF_LEN, 10, manager);
-        XMLString::binToText(getMinLength(), value2, BUF_LEN, 10, manager);
+        XMLString::sizeToText(tokenNumber, value1, BUF_LEN, 10, manager);
+        XMLString::sizeToText(getMinLength(), value2, BUF_LEN, 10, manager);
 
         ThrowXMLwithMemMgr3(InvalidDatatypeValueException
                 , XMLExcepts::VALUE_LT_minLen
@@ -207,8 +207,8 @@ void ListDatatypeValidator::checkContent(       BaseRefVectorOf<XMLCh>*       to
     {
         XMLCh value1[BUF_LEN+1];
         XMLCh value2[BUF_LEN+1];
-        XMLString::binToText(tokenNumber, value1, BUF_LEN, 10, manager);
-        XMLString::binToText(AbstractStringValidator::getLength(), value2, BUF_LEN, 10, manager);
+        XMLString::sizeToText(tokenNumber, value1, BUF_LEN, 10, manager);
+        XMLString::sizeToText(AbstractStringValidator::getLength(), value2, BUF_LEN, 10, manager);
 
         ThrowXMLwithMemMgr3(InvalidDatatypeValueException
                 , XMLExcepts::VALUE_NE_Len
@@ -286,13 +286,13 @@ void ListDatatypeValidator::checkValueSpace(const XMLCh* const
                                             , MemoryManager* const)
 {}
 
-int ListDatatypeValidator::getLength(const XMLCh* const content
+XMLSize_t ListDatatypeValidator::getLength(const XMLCh* const content
                                      , MemoryManager* const manager) const
 {
     BaseRefVectorOf<XMLCh>* tokenVector = XMLString::tokenizeString(content, manager);
     Janitor<BaseRefVectorOf<XMLCh> > janName(tokenVector);
 
-    return (int)tokenVector->size();
+    return tokenVector->size();
 }
 
 void ListDatatypeValidator::inspectFacetBase(MemoryManager* const manager)
diff --git a/src/xercesc/validators/datatype/ListDatatypeValidator.hpp b/src/xercesc/validators/datatype/ListDatatypeValidator.hpp
index ea1ef7fc887b225ad471381aec656ea38d853b1a..8ef1fa1cb470ddb161bb43892fccd690d43861bb 100644
--- a/src/xercesc/validators/datatype/ListDatatypeValidator.hpp
+++ b/src/xercesc/validators/datatype/ListDatatypeValidator.hpp
@@ -139,7 +139,7 @@ protected:
     virtual void checkValueSpace(const XMLCh* const content
                                 , MemoryManager* const manager);
 
-    virtual int getLength(const XMLCh* const content
+    virtual XMLSize_t getLength(const XMLCh* const content
             , MemoryManager* const manager) const;
 
     //