diff --git a/src/xercesc/dom/impl/DOMDocumentImpl.cpp b/src/xercesc/dom/impl/DOMDocumentImpl.cpp
index add84a47bb368c9c53cd6dd3b98ca9efd487f78a..0510051a07b174d7cb6e335ec9021faf889545b5 100644
--- a/src/xercesc/dom/impl/DOMDocumentImpl.cpp
+++ b/src/xercesc/dom/impl/DOMDocumentImpl.cpp
@@ -869,7 +869,8 @@ const XMLCh* DOMDocumentImpl::getVersion() const {
 }
 
 void DOMDocumentImpl::setVersion(const XMLCh* version){
-    if (XMLString::compareString(version, XMLUni::fgSupportedVersion))
+    if (XMLString::stringLen(version) &&
+        XMLString::compareString(version, XMLUni::fgSupportedVersion))
         throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0);
 
     fVersion = cloneString(version);