diff --git a/src/xercesc/dom/impl/DOMAttrImpl.cpp b/src/xercesc/dom/impl/DOMAttrImpl.cpp
index ba877b3d62196dfb70696b1f328ed406fe8378f7..fa0b3ad28acecc13ae974312faccb5bc9a7ba629 100644
--- a/src/xercesc/dom/impl/DOMAttrImpl.cpp
+++ b/src/xercesc/dom/impl/DOMAttrImpl.cpp
@@ -200,8 +200,7 @@ void DOMAttrImpl::setValue(const XMLCh *val)
 {
     if (fNode.isReadOnly())
     {
-        throw DOMException (
-            DOMException::NO_MODIFICATION_ALLOWED_ERR, 0);
+        throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager);
     }
 
     //  If this attribute was of type ID and in the map, take it out,
@@ -257,7 +256,7 @@ void DOMAttrImpl::setOwnerElement(DOMElement *ownerElem)
 void DOMAttrImpl::release()
 {
     if (fNode.isOwned() && !fNode.isToBeReleased())
-        throw DOMException(DOMException::INVALID_ACCESS_ERR,0);
+        throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager);
 
     DOMDocumentImpl* doc = (DOMDocumentImpl*) getOwnerDocument();
     if (doc) {
@@ -267,7 +266,7 @@ void DOMAttrImpl::release()
     }
     else {
         // shouldn't reach here
-        throw DOMException(DOMException::INVALID_ACCESS_ERR,0);
+        throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager);
     }
 }
 
diff --git a/src/xercesc/dom/impl/DOMAttrMapImpl.cpp b/src/xercesc/dom/impl/DOMAttrMapImpl.cpp
index ab599c48269ce25a6c9be8798c68cb1320808c6c..1ce949ac0bc17f912e3643fde8da1a6f688445c5 100644
--- a/src/xercesc/dom/impl/DOMAttrMapImpl.cpp
+++ b/src/xercesc/dom/impl/DOMAttrMapImpl.cpp
@@ -199,16 +199,16 @@ DOMNode * DOMAttrMapImpl::getNamedItem(const XMLCh *name) const
 DOMNode *DOMAttrMapImpl::setNamedItem(DOMNode *arg)
 {
     if (arg->getNodeType() != DOMNode::ATTRIBUTE_NODE)
-        throw DOMException(DOMException::HIERARCHY_REQUEST_ERR, 0);
+        throw DOMException(DOMException::HIERARCHY_REQUEST_ERR, 0, GetDOMNamedNodeMapMemoryManager);
 
     DOMDocument *doc = fOwnerNode->getOwnerDocument();
     DOMNodeImpl *argImpl = castToNodeImpl(arg);
     if(argImpl->getOwnerDocument() != doc)
-        throw DOMException(DOMException::WRONG_DOCUMENT_ERR,0);
+        throw DOMException(DOMException::WRONG_DOCUMENT_ERR, 0, GetDOMNamedNodeMapMemoryManager);
     if (this->readOnly())
-        throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0);
+        throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNamedNodeMapMemoryManager);
     if ((arg->getNodeType() == DOMNode::ATTRIBUTE_NODE) && argImpl->isOwned() && (argImpl->fOwnerNode != fOwnerNode))
-        throw DOMException(DOMException::INUSE_ATTRIBUTE_ERR,0);
+        throw DOMException(DOMException::INUSE_ATTRIBUTE_ERR,0, GetDOMNamedNodeMapMemoryManager);
 
     argImpl->fOwnerNode = fOwnerNode;
     argImpl->isOwned(true);
@@ -277,16 +277,16 @@ DOMNode *DOMAttrMapImpl::getNamedItemNS(const XMLCh *namespaceURI,
 DOMNode *DOMAttrMapImpl::setNamedItemNS(DOMNode* arg)
 {
     if (arg->getNodeType() != DOMNode::ATTRIBUTE_NODE)
-        throw DOMException(DOMException::HIERARCHY_REQUEST_ERR, 0);
+        throw DOMException(DOMException::HIERARCHY_REQUEST_ERR, 0, GetDOMNamedNodeMapMemoryManager);
 
     DOMDocument *doc = fOwnerNode->getOwnerDocument();
     DOMNodeImpl *argImpl = castToNodeImpl(arg);
     if (argImpl->getOwnerDocument() != doc)
-        throw DOMException(DOMException::WRONG_DOCUMENT_ERR,0);
+        throw DOMException(DOMException::WRONG_DOCUMENT_ERR,0, GetDOMNamedNodeMapMemoryManager);
     if (this->readOnly())
-        throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0);
+        throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNamedNodeMapMemoryManager);
     if (argImpl->isOwned())
-        throw DOMException(DOMException::INUSE_ATTRIBUTE_ERR,0);
+        throw DOMException(DOMException::INUSE_ATTRIBUTE_ERR,0, GetDOMNamedNodeMapMemoryManager);
 
     argImpl->fOwnerNode = fOwnerNode;
     argImpl->isOwned(true);
@@ -315,12 +315,12 @@ DOMNode *DOMAttrMapImpl::removeNamedItem(const XMLCh *name)
 {
     if (this->readOnly())
         throw DOMException(
-            DOMException::NO_MODIFICATION_ALLOWED_ERR, 0);
+            DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNamedNodeMapMemoryManager);
     int i=findNamePoint(name);
     DOMNode *removed = 0;
 
     if(i<0)
-        throw DOMException(DOMException::NOT_FOUND_ERR, 0);
+        throw DOMException(DOMException::NOT_FOUND_ERR, 0, GetDOMNamedNodeMapMemoryManager);
 
     removed = fNodes->elementAt(i);
     fNodes->removeElementAt(i);
@@ -347,10 +347,10 @@ DOMNode *DOMAttrMapImpl::removeNamedItemNS(const XMLCh *namespaceURI, const XMLC
 {
     if (this->readOnly())
         throw DOMException(
-        DOMException::NO_MODIFICATION_ALLOWED_ERR, 0);
+        DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNamedNodeMapMemoryManager);
     int i = findNamePoint(namespaceURI, localName);
     if (i < 0)
-        throw DOMException(DOMException::NOT_FOUND_ERR, 0);
+        throw DOMException(DOMException::NOT_FOUND_ERR, 0, GetDOMNamedNodeMapMemoryManager);
 
     DOMNode * removed = fNodes -> elementAt(i);
     fNodes -> removeElementAt(i);	//remove n from nodes
@@ -380,11 +380,11 @@ DOMNode * DOMAttrMapImpl::removeNamedItemAt(XMLSize_t index)
 {
     if (this->readOnly())
         throw DOMException(
-            DOMException::NO_MODIFICATION_ALLOWED_ERR, 0);
+            DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNamedNodeMapMemoryManager);
 
     DOMNode *removed = item(index);
     if(!removed)
-        throw DOMException(DOMException::NOT_FOUND_ERR, 0);
+        throw DOMException(DOMException::NOT_FOUND_ERR, 0, GetDOMNamedNodeMapMemoryManager);
 
     fNodes->removeElementAt(index);
     castToNodeImpl(removed)->fOwnerNode = fOwnerNode->getOwnerDocument();
diff --git a/src/xercesc/dom/impl/DOMAttrNSImpl.cpp b/src/xercesc/dom/impl/DOMAttrNSImpl.cpp
index 779a738f6a45e503a17de1388969d54c5b0a60c8..d3fccea0b20dff58e5c60d71dddfdeef98137e5d 100644
--- a/src/xercesc/dom/impl/DOMAttrNSImpl.cpp
+++ b/src/xercesc/dom/impl/DOMAttrNSImpl.cpp
@@ -124,13 +124,12 @@ void DOMAttrNSImpl::setPrefix(const XMLCh *prefix)
     const XMLCh * xmlnsURI = DOMNodeImpl::getXmlnsURIString();
 
     if (fNode.isReadOnly())
-        throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR,
-        0);
+        throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager);
     if (fNamespaceURI == 0 || fNamespaceURI[0] == chNull || XMLString::equals(fLocalName, xmlns))
-        throw DOMException(DOMException::NAMESPACE_ERR, 0);
+        throw DOMException(DOMException::NAMESPACE_ERR, 0, GetDOMNodeMemoryManager);
 
     if (prefix != 0 && !((DOMDocumentImpl *)this->getOwnerDocument())->isXMLName(prefix))
-        throw DOMException(DOMException::INVALID_CHARACTER_ERR,0);
+        throw DOMException(DOMException::INVALID_CHARACTER_ERR,0, GetDOMNodeMemoryManager);
 
     if (prefix == 0 || prefix[0] == chNull) {
         fName = fLocalName;
@@ -142,10 +141,10 @@ void DOMAttrNSImpl::setPrefix(const XMLCh *prefix)
         !XMLString::equals(fNamespaceURI, xmlURI)||
         XMLString::equals(prefix, xmlns)&&
         !XMLString::equals(fNamespaceURI, xmlnsURI))
-        throw DOMException(DOMException::NAMESPACE_ERR, 0);
+        throw DOMException(DOMException::NAMESPACE_ERR, 0, GetDOMNodeMemoryManager);
 
     if (XMLString::indexOf(prefix, chColon) != -1) {
-        throw DOMException(DOMException::NAMESPACE_ERR, 0);
+        throw DOMException(DOMException::NAMESPACE_ERR, 0, GetDOMNodeMemoryManager);
     }
 
     this-> fPrefix = ((DOMDocumentImpl *)this->getOwnerDocument())->getPooledString(prefix);
@@ -178,7 +177,7 @@ void DOMAttrNSImpl::setPrefix(const XMLCh *prefix)
 void DOMAttrNSImpl::release()
 {
     if (fNode.isOwned() && !fNode.isToBeReleased())
-        throw DOMException(DOMException::INVALID_ACCESS_ERR,0);
+        throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager);
 
     DOMDocumentImpl* doc = (DOMDocumentImpl*) getOwnerDocument();
     if (doc) {
@@ -188,7 +187,7 @@ void DOMAttrNSImpl::release()
     }
     else {
         // shouldn't reach here
-        throw DOMException(DOMException::INVALID_ACCESS_ERR,0);
+        throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager);
     }
 }
 
@@ -216,13 +215,13 @@ void DOMAttrNSImpl::setName(const XMLCh* namespaceURI, const XMLCh* qualifiedNam
 
     int index = DOMDocumentImpl::indexofQualifiedName(qualifiedName);
     if (index < 0)
-        throw DOMException(DOMException::NAMESPACE_ERR, 0);
+        throw DOMException(DOMException::NAMESPACE_ERR, 0, GetDOMNodeMemoryManager);
 
     bool xmlnsAlone = false;	//true if attribute name is "xmlns"
     if (index == 0) {	//qualifiedName contains no ':'
         if (XMLString::equals(this->fName, xmlns)) {
             if (!XMLString::equals(namespaceURI, xmlnsURI))
-                throw DOMException(DOMException::NAMESPACE_ERR, 0);
+                throw DOMException(DOMException::NAMESPACE_ERR, 0, GetDOMNodeMemoryManager);
             xmlnsAlone = true;
         }
         this -> fPrefix = 0;
@@ -248,7 +247,7 @@ void DOMAttrNSImpl::setName(const XMLCh* namespaceURI, const XMLCh* qualifiedNam
 
         // Before we carry on, we should check if the prefix or localName are valid XMLName
         if (!((DOMDocumentImpl *)this->getOwnerDocument())->isXMLName(fPrefix) || !((DOMDocumentImpl *)this->getOwnerDocument())->isXMLName(fLocalName))
-            throw DOMException(DOMException::NAMESPACE_ERR, 0);
+            throw DOMException(DOMException::NAMESPACE_ERR, 0, GetDOMNodeMemoryManager);
     }
 
     // DOM Level 3: namespace URI is never empty string.
diff --git a/src/xercesc/dom/impl/DOMCDATASectionImpl.cpp b/src/xercesc/dom/impl/DOMCDATASectionImpl.cpp
index dc42608207a9dd124134859c8fb2dfcd556a8195..9d6241b541bec0abd60a6868e9f33a0bc514b4e9 100644
--- a/src/xercesc/dom/impl/DOMCDATASectionImpl.cpp
+++ b/src/xercesc/dom/impl/DOMCDATASectionImpl.cpp
@@ -69,7 +69,6 @@
 
 XERCES_CPP_NAMESPACE_BEGIN
 
-
 DOMCDATASectionImpl::DOMCDATASectionImpl(DOMDocument *ownerDoc,
                                    const XMLCh *dat)
     : fNode(ownerDoc), fParent(ownerDoc), fCharacterData(ownerDoc, dat)
@@ -126,12 +125,11 @@ DOMText *DOMCDATASectionImpl::splitText(XMLSize_t offset)
 {
     if (fNode.isReadOnly())
     {
-        throw DOMException(
-            DOMException::NO_MODIFICATION_ALLOWED_ERR, 0);
+        throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager);
     }
     XMLSize_t len = fCharacterData.fDataBuf->getLen();
     if (offset > len || offset < 0)
-        throw DOMException(DOMException::INDEX_SIZE_ERR, 0);
+        throw DOMException(DOMException::INDEX_SIZE_ERR, 0, GetDOMNodeMemoryManager);
 
     DOMText *newText =
                 getOwnerDocument()->createCDATASection(
@@ -165,12 +163,12 @@ bool DOMCDATASectionImpl::getIsWhitespaceInElementContent() const
 }
 
 const XMLCh* DOMCDATASectionImpl::getWholeText() {
-    throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0);
+    throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0, GetDOMNodeMemoryManager);
     return 0;
 }
 
 DOMText* DOMCDATASectionImpl::replaceWholeText(const XMLCh*){
-    throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0);
+    throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0, GetDOMNodeMemoryManager);
     return 0;
 }
 
@@ -178,7 +176,7 @@ DOMText* DOMCDATASectionImpl::replaceWholeText(const XMLCh*){
 void DOMCDATASectionImpl::release()
 {
     if (fNode.isOwned() && !fNode.isToBeReleased())
-        throw DOMException(DOMException::INVALID_ACCESS_ERR,0);
+        throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager);
 
     DOMDocumentImpl* doc = (DOMDocumentImpl*) getOwnerDocument();
 
@@ -190,7 +188,7 @@ void DOMCDATASectionImpl::release()
     }
     else {
         // shouldn't reach here
-        throw DOMException(DOMException::INVALID_ACCESS_ERR,0);
+        throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager);
     }
 }
 
diff --git a/src/xercesc/dom/impl/DOMCharacterDataImpl.cpp b/src/xercesc/dom/impl/DOMCharacterDataImpl.cpp
index 4bbe5cc53f53b57a95d09246df2ad57ea7a5f068..feae24986cbe4f803e3fbb8ceb4cfe3def681303 100644
--- a/src/xercesc/dom/impl/DOMCharacterDataImpl.cpp
+++ b/src/xercesc/dom/impl/DOMCharacterDataImpl.cpp
@@ -69,7 +69,6 @@
 
 XERCES_CPP_NAMESPACE_BEGIN
 
-
 DOMCharacterDataImpl::DOMCharacterDataImpl(DOMDocument *doc, const XMLCh *dat)
  : fDataBuf(0)
  , fDoc(0)
@@ -113,8 +112,7 @@ const XMLCh * DOMCharacterDataImpl::getNodeValue() const
 void DOMCharacterDataImpl::setNodeValue(const DOMNode *node, const XMLCh *value)
 {
     if (castToNodeImpl(node)->isReadOnly())
-        throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR,
-                               0);
+        throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMCharacterDataImplMemoryManager);
     fDataBuf->set(value);
 
     if (node->getOwnerDocument() != 0) {
@@ -135,7 +133,7 @@ void DOMCharacterDataImpl::appendData(const DOMNode *node, const XMLCh *dat)
 {
     if(castToNodeImpl(node)->isReadOnly())
         throw DOMException(
-        DOMException::NO_MODIFICATION_ALLOWED_ERR, 0);
+        DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMCharacterDataImplMemoryManager);
 
     fDataBuf->append(dat);
 }
@@ -144,7 +142,7 @@ void DOMCharacterDataImpl::appendData(const DOMNode *node, const XMLCh *dat)
 void DOMCharacterDataImpl::deleteData(const DOMNode *node, XMLSize_t offset, XMLSize_t count)
 {
     if (castToNodeImpl(node)->isReadOnly())
-        throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0);
+        throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMCharacterDataImplMemoryManager);
 
     // Note: the C++ XMLCh * operation throws the correct DOMExceptions
     //       when parameter values are bad.
@@ -152,7 +150,7 @@ void DOMCharacterDataImpl::deleteData(const DOMNode *node, XMLSize_t offset, XML
 
     XMLSize_t len = this->fDataBuf->getLen();
     if (offset > len || offset < 0 || count < 0)
-        throw DOMException(DOMException::INDEX_SIZE_ERR, 0);
+        throw DOMException(DOMException::INDEX_SIZE_ERR, 0, GetDOMCharacterDataImplMemoryManager);
 
 
 
@@ -225,7 +223,7 @@ void DOMCharacterDataImpl::insertData(const DOMNode *node, XMLSize_t offset, con
 {
     if (castToNodeImpl(node)->isReadOnly())
         throw DOMException(
-        DOMException::NO_MODIFICATION_ALLOWED_ERR, 0);
+        DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMCharacterDataImplMemoryManager);
 
     // Note: the C++ XMLCh * operation throws the correct DOMExceptions
     //       when parameter values are bad.
@@ -233,7 +231,7 @@ void DOMCharacterDataImpl::insertData(const DOMNode *node, XMLSize_t offset, con
 
     XMLSize_t len = fDataBuf->getLen();
     if (offset > len || offset < 0)
-        throw DOMException(DOMException::INDEX_SIZE_ERR, 0);
+        throw DOMException(DOMException::INDEX_SIZE_ERR, 0, GetDOMCharacterDataImplMemoryManager);
 
     XMLSize_t datLen = XMLString::stringLen(dat);
 
@@ -278,7 +276,7 @@ void DOMCharacterDataImpl::replaceData(const DOMNode *node, XMLSize_t offset, XM
 {
     if (castToNodeImpl(node)->isReadOnly())
         throw DOMException(
-        DOMException::NO_MODIFICATION_ALLOWED_ERR, 0);
+        DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMCharacterDataImplMemoryManager);
 
     deleteData(node, offset, count);
     insertData(node, offset, dat);
@@ -308,7 +306,7 @@ const XMLCh * DOMCharacterDataImpl::substringData(const DOMNode *node, XMLSize_t
     XMLSize_t len = fDataBuf->getLen();
 
     if (offset > len || offset < 0 || count < 0)
-        throw DOMException(DOMException::INDEX_SIZE_ERR, 0);
+        throw DOMException(DOMException::INDEX_SIZE_ERR, 0, GetDOMCharacterDataImplMemoryManager);
 
 
     XMLCh* newString;
diff --git a/src/xercesc/dom/impl/DOMCharacterDataImpl.hpp b/src/xercesc/dom/impl/DOMCharacterDataImpl.hpp
index 4cb637eeb8129f7201b12de1fb2410ae74b47e11..13654f697cf2d4cdc5efe17f997a0916f3f7b842 100644
--- a/src/xercesc/dom/impl/DOMCharacterDataImpl.hpp
+++ b/src/xercesc/dom/impl/DOMCharacterDataImpl.hpp
@@ -118,6 +118,8 @@ private:
     DOMCharacterDataImpl & operator = (const DOMCharacterDataImpl &);   
 };
 
+#define GetDOMCharacterDataImplMemoryManager GET_DIRECT_MM(fDoc)
+
 XERCES_CPP_NAMESPACE_END
 
 
diff --git a/src/xercesc/dom/impl/DOMCommentImpl.cpp b/src/xercesc/dom/impl/DOMCommentImpl.cpp
index 8ef9db7b4f80c8e13fb15c99eca77b3b6687a4aa..d82ac69c40e7ad94483be91581818bd5b8f91452 100644
--- a/src/xercesc/dom/impl/DOMCommentImpl.cpp
+++ b/src/xercesc/dom/impl/DOMCommentImpl.cpp
@@ -70,7 +70,6 @@
 
 XERCES_CPP_NAMESPACE_BEGIN
 
-
 DOMCommentImpl::DOMCommentImpl(DOMDocument *ownerDoc, const XMLCh *dat)
     : fNode(ownerDoc),  fCharacterData(ownerDoc, dat)
 {
@@ -114,7 +113,7 @@ short DOMCommentImpl::getNodeType() const {
 void DOMCommentImpl::release()
 {
     if (fNode.isOwned() && !fNode.isToBeReleased())
-        throw DOMException(DOMException::INVALID_ACCESS_ERR,0);
+        throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager);
 
     DOMDocumentImpl* doc = (DOMDocumentImpl*) getOwnerDocument();
     if (doc) {
@@ -124,7 +123,7 @@ void DOMCommentImpl::release()
     }
     else {
         // shouldn't reach here
-        throw DOMException(DOMException::INVALID_ACCESS_ERR,0);
+        throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager);
     }
 }
 
@@ -135,11 +134,11 @@ DOMComment *DOMCommentImpl::splitText(XMLSize_t offset)
     if (fNode.isReadOnly())
     {
         throw DOMException(
-            DOMException::NO_MODIFICATION_ALLOWED_ERR, 0);
+            DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager);
     }
     XMLSize_t len = fCharacterData.fDataBuf->getLen();
     if (offset > len || offset < 0)
-        throw DOMException(DOMException::INDEX_SIZE_ERR, 0);
+        throw DOMException(DOMException::INDEX_SIZE_ERR, 0, GetDOMNodeMemoryManager);
 
     DOMComment *newText =
                 getOwnerDocument()->createComment(
diff --git a/src/xercesc/dom/impl/DOMConfigurationImpl.cpp b/src/xercesc/dom/impl/DOMConfigurationImpl.cpp
index 32955ab433c9432c42fed10f42df678aeb36051f..d2d18297a51a451456942d11d44a01adc06c9aa9 100644
--- a/src/xercesc/dom/impl/DOMConfigurationImpl.cpp
+++ b/src/xercesc/dom/impl/DOMConfigurationImpl.cpp
@@ -137,7 +137,7 @@ void DOMConfigurationImpl::setParameter(const XMLCh* name, const void* value) {
     XMLString::lowerCase(lowerCaseName);
 
     if(!canSetParameter(lowerCaseName, value)) {
-        throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0);
+        throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0, fMemoryManager);
     }
 
     bool isBooleanParameter = true;
@@ -163,7 +163,7 @@ void DOMConfigurationImpl::setParameter(const XMLCh* name, const void* value) {
         } else if (XMLString::equals(lowerCaseName, fgSCHEMA_LOCATION)) {
             fSchemaLocation = (XMLCh*)value;
         } else {  // canSetParameter above should take care of this case
-            throw DOMException(DOMException::NOT_FOUND_ERR, 0);
+            throw DOMException(DOMException::NOT_FOUND_ERR, 0, fMemoryManager);
         }
     }
 
@@ -203,7 +203,7 @@ const void* DOMConfigurationImpl::getParameter(const XMLCh* name) const {
         } else if (XMLString::equals(lowerCaseName, fgSCHEMA_LOCATION)) {
             return fSchemaLocation;
         } else {
-            throw DOMException(DOMException::NOT_FOUND_ERR, 0);
+            throw DOMException(DOMException::NOT_FOUND_ERR, 0, fMemoryManager);
         }
     }
 
@@ -338,7 +338,7 @@ DOMConfigurationImpl::DOMConfigurationFeature DOMConfigurationImpl::getFeatureFl
     } else if (XMLString::equals(lowerCaseName, fgWHITESPACE_IN_ELEMENT_CONTENT)) {
         return FEATURE_WHITESPACE_IN_ELEMENT_CONTENT;
     } else {
-        throw DOMException(DOMException::NOT_FOUND_ERR, 0);
+        throw DOMException(DOMException::NOT_FOUND_ERR, 0, fMemoryManager);
     }
         
 }
diff --git a/src/xercesc/dom/impl/DOMDocumentFragmentImpl.cpp b/src/xercesc/dom/impl/DOMDocumentFragmentImpl.cpp
index 9c6883f40f5d85e0f25891fc3cffcb5af6c9581c..e80cd9b2c7625c60a7ca99d7eb469b0b66eee426 100644
--- a/src/xercesc/dom/impl/DOMDocumentFragmentImpl.cpp
+++ b/src/xercesc/dom/impl/DOMDocumentFragmentImpl.cpp
@@ -67,7 +67,6 @@
 
 XERCES_CPP_NAMESPACE_BEGIN
 
-
 DOMDocumentFragmentImpl::DOMDocumentFragmentImpl(DOMDocument *masterDoc)
     : fNode(masterDoc), fParent(masterDoc)
 {
@@ -119,7 +118,7 @@ void DOMDocumentFragmentImpl::setNodeValue(const XMLCh *x)
 void DOMDocumentFragmentImpl::release()
 {
     if (fNode.isOwned() && !fNode.isToBeReleased())
-        throw DOMException(DOMException::INVALID_ACCESS_ERR,0);
+        throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager);
 
     DOMDocumentImpl* doc = (DOMDocumentImpl*) getOwnerDocument();
     if (doc) {
@@ -129,7 +128,7 @@ void DOMDocumentFragmentImpl::release()
     }
     else {
         // shouldn't reach here
-        throw DOMException(DOMException::INVALID_ACCESS_ERR,0);
+        throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager);
     }
 }
 
diff --git a/src/xercesc/dom/impl/DOMDocumentImpl.cpp b/src/xercesc/dom/impl/DOMDocumentImpl.cpp
index 92ae1797002fb3c40400b18f89a9ec9e75e99bb9..5cbf3d635c13f13e26df7a7a98be0d05b34fb877 100644
--- a/src/xercesc/dom/impl/DOMDocumentImpl.cpp
+++ b/src/xercesc/dom/impl/DOMDocumentImpl.cpp
@@ -168,7 +168,7 @@ DOMDocumentImpl::DOMDocumentImpl(const XMLCh *fNamespaceURI,
         if (qualifiedName)
             appendChild(createElementNS(fNamespaceURI, qualifiedName));  //root element
         else if (fNamespaceURI)
-            throw DOMException(DOMException::NAMESPACE_ERR, 0);
+            throw DOMException(DOMException::NAMESPACE_ERR, 0, getMemoryManager());
     }
     catch(const OutOfMemoryException&)
     {
@@ -190,7 +190,7 @@ void DOMDocumentImpl::setDocumentType(DOMDocumentType *doctype)
     //   ownerDocument will be set, but the DocType won't yet be a child of the document.
     if (doctype->getOwnerDocument() != 0 && doctype->getOwnerDocument() != this)
         throw DOMException(    //one doctype can belong to only one DOMDocumentImpl
-        DOMException::WRONG_DOCUMENT_ERR, 0);
+        DOMException::WRONG_DOCUMENT_ERR, 0, getMemoryManager());
 
     DOMDocumentTypeImpl* doctypeImpl = (DOMDocumentTypeImpl*) doctype;
     doctypeImpl->setOwnerDocument(this);
@@ -278,7 +278,7 @@ DOMDocument * DOMDocumentImpl::getOwnerDocument() const {
 DOMAttr *DOMDocumentImpl::createAttribute(const XMLCh *nam)
 {
     if(!nam || !isXMLName(nam))
-        throw DOMException(DOMException::INVALID_CHARACTER_ERR,0);
+        throw DOMException(DOMException::INVALID_CHARACTER_ERR,0, getMemoryManager());
     return new (this, DOMDocumentImpl::ATTR_OBJECT) DOMAttrImpl(this,nam);
 }
 
@@ -308,7 +308,7 @@ DOMDocumentType *DOMDocumentImpl::createDocumentType(const XMLCh *nam)
 {
     if (!nam || !isXMLName(nam))
         throw DOMException(
-        DOMException::INVALID_CHARACTER_ERR, 0);
+        DOMException::INVALID_CHARACTER_ERR, 0, getMemoryManager());
 
     return new (this, DOMDocumentImpl::DOCUMENT_TYPE_OBJECT) DOMDocumentTypeImpl(this, nam, false);
 }
@@ -322,7 +322,7 @@ DOMDocumentType *
 {
     if (!qualifiedName || !isXMLName(qualifiedName))
         throw DOMException(
-        DOMException::INVALID_CHARACTER_ERR, 0);
+        DOMException::INVALID_CHARACTER_ERR, 0, getMemoryManager());
 
     return new (this, DOMDocumentImpl::DOCUMENT_TYPE_OBJECT) DOMDocumentTypeImpl(this, qualifiedName, publicId, systemId, false);
 }
@@ -332,7 +332,7 @@ DOMDocumentType *
 DOMElement *DOMDocumentImpl::createElement(const XMLCh *tagName)
 {
     if(!tagName || !isXMLName(tagName))
-        throw DOMException(DOMException::INVALID_CHARACTER_ERR,0);
+        throw DOMException(DOMException::INVALID_CHARACTER_ERR,0, getMemoryManager());
 
     return new (this, DOMDocumentImpl::ELEMENT_OBJECT) DOMElementImpl(this,tagName);
 }
@@ -350,7 +350,7 @@ DOMEntity *DOMDocumentImpl::createEntity(const XMLCh *nam)
 {
     if (!nam || !isXMLName(nam))
         throw DOMException(
-        DOMException::INVALID_CHARACTER_ERR, 0);
+        DOMException::INVALID_CHARACTER_ERR, 0, getMemoryManager());
 
     return new (this, DOMDocumentImpl::ENTITY_OBJECT) DOMEntityImpl(this, nam);
 }
@@ -361,7 +361,7 @@ DOMEntityReference *DOMDocumentImpl::createEntityReference(const XMLCh *nam)
 {
     if (!nam || !isXMLName(nam))
         throw DOMException(
-        DOMException::INVALID_CHARACTER_ERR, 0);
+        DOMException::INVALID_CHARACTER_ERR, 0, getMemoryManager());
 
     return new (this, DOMDocumentImpl::ENTITY_REFERENCE_OBJECT) DOMEntityReferenceImpl(this, nam);
 }
@@ -370,7 +370,7 @@ DOMEntityReference *DOMDocumentImpl::createEntityReferenceByParser(const XMLCh *
 {
     if (!nam || !isXMLName(nam))
         throw DOMException(
-        DOMException::INVALID_CHARACTER_ERR, 0);
+        DOMException::INVALID_CHARACTER_ERR, 0, getMemoryManager());
 
     return new (this, DOMDocumentImpl::ENTITY_REFERENCE_OBJECT) DOMEntityReferenceImpl(this, nam, false);
 }
@@ -379,7 +379,7 @@ DOMNotation *DOMDocumentImpl::createNotation(const XMLCh *nam)
 {
     if (!nam || !isXMLName(nam))
         throw DOMException(
-        DOMException::INVALID_CHARACTER_ERR, 0);
+        DOMException::INVALID_CHARACTER_ERR, 0, getMemoryManager());
 
     return new (this, DOMDocumentImpl::NOTATION_OBJECT) DOMNotationImpl(this, nam);
 }
@@ -390,7 +390,7 @@ DOMProcessingInstruction *DOMDocumentImpl::createProcessingInstruction(
                                           const XMLCh *target, const XMLCh *data)
 {
     if(!target || !isXMLName(target))
-        throw DOMException(DOMException::INVALID_CHARACTER_ERR,0);
+        throw DOMException(DOMException::INVALID_CHARACTER_ERR,0, getMemoryManager());
     return new (this, DOMDocumentImpl::PROCESSING_INSTRUCTION_OBJECT) DOMProcessingInstructionImpl(this,target,data);
 }
 
@@ -407,7 +407,7 @@ DOMNodeIterator* DOMDocumentImpl::createNodeIterator (
           DOMNode *root, unsigned long whatToShow, DOMNodeFilter* filter, bool entityReferenceExpansion)
 {
     if (!root) {
-        throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0);
+        throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0, getMemoryManager());
         return 0;
     }
 
@@ -446,21 +446,21 @@ void DOMDocumentImpl::removeNodeIterator(DOMNodeIteratorImpl* nodeIterator)
 
 const DOMXPathExpression* DOMDocumentImpl::createExpression(const XMLCh *, const DOMXPathNSResolver *)
 {
-    throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0);
+    throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0, getMemoryManager());
     return 0;
 }
 
 const DOMXPathNSResolver* DOMDocumentImpl::createNSResolver(DOMNode *)
 
 {
-    throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0);
+    throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0, getMemoryManager());
     return 0;
 }
 
 void* DOMDocumentImpl::evaluate(const XMLCh *, DOMNode *, const DOMXPathNSResolver *, 
                            unsigned short, void* ) 
 {
-    throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0);
+    throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0, getMemoryManager());
     return 0;
 }
 
@@ -469,7 +469,7 @@ void* DOMDocumentImpl::evaluate(const XMLCh *, DOMNode *, const DOMXPathNSResolv
 DOMTreeWalker* DOMDocumentImpl::createTreeWalker (DOMNode *root, unsigned long whatToShow, DOMNodeFilter* filter, bool entityReferenceExpansion)
 {
     if (!root) {
-        throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0);
+        throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0, getMemoryManager());
         return 0;
     }
 
@@ -513,7 +513,7 @@ DOMNode *DOMDocumentImpl::insertBefore(DOMNode *newChild, DOMNode *refChild)
         ||
         (newChild->getNodeType() == DOMNode::DOCUMENT_TYPE_NODE  && fDocType!=0)
         )
-        throw DOMException(DOMException::HIERARCHY_REQUEST_ERR,0);
+        throw DOMException(DOMException::HIERARCHY_REQUEST_ERR,0, getMemoryManager());
 
     // if the newChild is a documenttype node created from domimplementation, set the ownerDoc first
     if ((newChild->getNodeType() == DOMNode::DOCUMENT_TYPE_NODE) && !newChild->getOwnerDocument())
@@ -604,7 +604,7 @@ DOMElement *DOMDocumentImpl::createElementNS(const XMLCh *fNamespaceURI,
     const XMLCh *qualifiedName)
 {
     if(!qualifiedName || !isXMLName(qualifiedName))
-        throw DOMException(DOMException::INVALID_CHARACTER_ERR,0);
+        throw DOMException(DOMException::INVALID_CHARACTER_ERR,0, getMemoryManager());
     //XMLCh * pooledTagName = this->fNamePool->getPooledString(qualifiedName);
     return new (this, DOMDocumentImpl::ELEMENT_NS_OBJECT) DOMElementNSImpl(this, fNamespaceURI, qualifiedName);
 }
@@ -615,7 +615,7 @@ DOMElement *DOMDocumentImpl::createElementNS(const XMLCh *fNamespaceURI,
                                               const XMLSSize_t columnNo)
 {
     if(!qualifiedName || !isXMLName(qualifiedName))
-        throw DOMException(DOMException::INVALID_CHARACTER_ERR,0);
+        throw DOMException(DOMException::INVALID_CHARACTER_ERR,0, getMemoryManager());
 
     return new (this) XSDElementNSImpl(this, fNamespaceURI, qualifiedName, lineNo, columnNo);
 }
@@ -625,7 +625,7 @@ DOMAttr *DOMDocumentImpl::createAttributeNS(const XMLCh *fNamespaceURI,
     const XMLCh *qualifiedName)
 {
     if(!qualifiedName || !isXMLName(qualifiedName))
-        throw DOMException(DOMException::INVALID_CHARACTER_ERR,0);
+        throw DOMException(DOMException::INVALID_CHARACTER_ERR,0, getMemoryManager());
     return new (this, DOMDocumentImpl::ATTR_NS_OBJECT) DOMAttrNSImpl(this, fNamespaceURI, qualifiedName);
 }
 
@@ -981,7 +981,7 @@ void DOMDocumentImpl::setVersion(const XMLCh* version){
     if ((version && *version) &&
         !XMLString::equals(version, XMLUni::fgVersion1_0) &&
         !XMLString::equals(version, XMLUni::fgVersion1_1))
-        throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0);
+        throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0, getMemoryManager());
 
     fVersion = cloneString(version);
 }
@@ -1010,7 +1010,7 @@ void DOMDocumentImpl::setStrictErrorChecking(bool strictErrorChecking) {
 }
 
 DOMNode* DOMDocumentImpl::adoptNode(DOMNode*) {
-    throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0);
+    throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0, getMemoryManager());
     return 0;
 }
 
@@ -1122,7 +1122,7 @@ DOMNode *DOMDocumentImpl::importNode(DOMNode *source, bool deep, bool cloningDoc
             // unless this is used as part of cloning a Document
             // forbid it for the sake of being compliant to the DOM spec
             if (!cloningDoc)
-                throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0);
+                throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0, getMemoryManager());
 
             DOMDocumentType *srcdoctype = (DOMDocumentType *)source;
             DOMDocumentType *newdoctype = (DOMDocumentType *)
@@ -1170,7 +1170,7 @@ DOMNode *DOMDocumentImpl::importNode(DOMNode *source, bool deep, bool cloningDoc
 
     case DOMNode::DOCUMENT_NODE : // Document can't be child of Document
     default:                       // Unknown node type
-        throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0);
+        throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0, getMemoryManager());
     }
 
     // If deep, replicate and attach the kids.
@@ -1309,9 +1309,9 @@ DOMNode* DOMDocumentImpl::renameNode(DOMNode* n, const XMLCh* namespaceURI, cons
 {
     if (n->getOwnerDocument() != this)
         if (n->getNodeType() == DOCUMENT_NODE)
-            throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0);
+            throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0, getMemoryManager());
         else
-            throw DOMException(DOMException::WRONG_DOCUMENT_ERR, 0);
+            throw DOMException(DOMException::WRONG_DOCUMENT_ERR, 0, getMemoryManager());
 
     switch (n->getNodeType()) {
         case ELEMENT_NODE:
@@ -1319,7 +1319,7 @@ DOMNode* DOMDocumentImpl::renameNode(DOMNode* n, const XMLCh* namespaceURI, cons
         case ATTRIBUTE_NODE:
             return ((DOMAttrImpl*)n)->rename(namespaceURI, name);
         default:
-            throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0);
+            throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0, getMemoryManager());
     }
 
     return 0;
diff --git a/src/xercesc/dom/impl/DOMDocumentTypeImpl.cpp b/src/xercesc/dom/impl/DOMDocumentTypeImpl.cpp
index fd8449ef611b354d2706839a54f71380ac7cb691..52c88dbabcf339282f9e80a39041cf2ab44281c2 100644
--- a/src/xercesc/dom/impl/DOMDocumentTypeImpl.cpp
+++ b/src/xercesc/dom/impl/DOMDocumentTypeImpl.cpp
@@ -162,7 +162,7 @@ DOMDocumentTypeImpl::DOMDocumentTypeImpl(DOMDocument *ownerDoc,
 {
     int index = DOMDocumentImpl::indexofQualifiedName(qualifiedName);
     if (index < 0)
-        throw DOMException(DOMException::NAMESPACE_ERR, 0);
+        throw DOMException(DOMException::NAMESPACE_ERR, 0, GetDOMNodeMemoryManager);
     else if (index > 0)
     {
         // we have to make sure the qualifiedName has correct prefix and localName
@@ -183,12 +183,12 @@ DOMDocumentTypeImpl::DOMDocumentTypeImpl(DOMDocument *ownerDoc,
         // Before we carry on, we should check if the prefix or localName are valid XMLName
         if (ownerDoc) {
             if (!((DOMDocumentImpl*)ownerDoc)->isXMLName(newName) || !((DOMDocumentImpl*)ownerDoc)->isXMLName(qualifiedName+index+1))
-                throw DOMException(DOMException::NAMESPACE_ERR, 0);
+                throw DOMException(DOMException::NAMESPACE_ERR, 0, GetDOMNodeMemoryManager);
         }
         else {
             // document is not there yet, so assume XML 1.0
             if (!XMLChar1_0::isValidName(newName, index) || !XMLChar1_0::isValidName(qualifiedName+index+1, XMLString::stringLen(qualifiedName)-index-1))
-                throw DOMException(DOMException::NAMESPACE_ERR, 0);
+                throw DOMException(DOMException::NAMESPACE_ERR, 0, GetDOMNodeMemoryManager);
         }
 
         if (index >= 3999)
@@ -417,7 +417,7 @@ void DOMDocumentTypeImpl::release()
             }
         }
         else
-            throw DOMException(DOMException::INVALID_ACCESS_ERR,0);
+            throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager);
     }
     else {
         if (fIsCreatedFromHeap) {
@@ -433,7 +433,7 @@ void DOMDocumentTypeImpl::release()
             }
             else {
                 // shouldn't reach here
-                throw DOMException(DOMException::INVALID_ACCESS_ERR,0);
+                throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager);
             }
         }
     }
diff --git a/src/xercesc/dom/impl/DOMElementImpl.cpp b/src/xercesc/dom/impl/DOMElementImpl.cpp
index e67066f46aea7d2a1e77c8434b44c742e3a95626..321892e01b9d46ada999b376367eff88852de773 100644
--- a/src/xercesc/dom/impl/DOMElementImpl.cpp
+++ b/src/xercesc/dom/impl/DOMElementImpl.cpp
@@ -81,7 +81,6 @@
 
 XERCES_CPP_NAMESPACE_BEGIN
 
-
 class DOMAttr;
 
 DOMElementImpl::DOMElementImpl(DOMDocument *ownerDoc, const XMLCh *eName)
@@ -207,7 +206,7 @@ void DOMElementImpl::removeAttribute(const XMLCh *nam)
 {
     if (fNode.isReadOnly())
         throw DOMException(
-             DOMException::NO_MODIFICATION_ALLOWED_ERR, 0);
+             DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager);
 
     XMLSSize_t i = fAttributes->findNamePoint(nam);
     if (i >= 0)
@@ -224,7 +223,7 @@ DOMAttr *DOMElementImpl::removeAttributeNode(DOMAttr *oldAttr)
 {
     if (fNode.isReadOnly())
         throw DOMException(
-        DOMException::NO_MODIFICATION_ALLOWED_ERR, 0);
+        DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager);
 
     DOMNode* found = 0;
 
@@ -244,11 +243,11 @@ DOMAttr *DOMElementImpl::removeAttributeNode(DOMAttr *oldAttr)
             ((DOMAttrImpl *)oldAttr)->removeAttrFromIDNodeMap();
         }
         else
-            throw DOMException(DOMException::NOT_FOUND_ERR, 0);
+            throw DOMException(DOMException::NOT_FOUND_ERR, 0, GetDOMNodeMemoryManager);
 
     }
     else
-        throw DOMException(DOMException::NOT_FOUND_ERR, 0);
+        throw DOMException(DOMException::NOT_FOUND_ERR, 0, GetDOMNodeMemoryManager);
 
    return (DOMAttr *)found;
 }
@@ -259,7 +258,7 @@ void DOMElementImpl::setAttribute(const XMLCh *nam, const XMLCh *val)
 {
     if (fNode.isReadOnly())
         throw DOMException(
-        DOMException::NO_MODIFICATION_ALLOWED_ERR, 0);
+        DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager);
 
     DOMAttr* newAttr = getAttributeNode(nam);
     if (!newAttr)
@@ -275,12 +274,12 @@ void DOMElementImpl::setIdAttribute(const XMLCh* name)
 {
     if (fNode.isReadOnly())
         throw DOMException(
-        DOMException::NO_MODIFICATION_ALLOWED_ERR, 0);
+        DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager);
 
     DOMAttr *attr = getAttributeNode(name);
 
     if (!attr) 
-        throw DOMException(DOMException::NOT_FOUND_ERR, 0);
+        throw DOMException(DOMException::NOT_FOUND_ERR, 0, GetDOMNodeMemoryManager);
 
     ((DOMAttrImpl *)attr)->addAttrToIDNodeMap();
 }
@@ -289,12 +288,12 @@ void DOMElementImpl::setIdAttributeNS(const XMLCh* namespaceURI, const XMLCh* lo
 
     if (fNode.isReadOnly())
         throw DOMException(
-        DOMException::NO_MODIFICATION_ALLOWED_ERR, 0);
+        DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager);
 
     DOMAttr *attr = getAttributeNodeNS(namespaceURI, localName);
 
     if (!attr) 
-        throw DOMException(DOMException::NOT_FOUND_ERR, 0);
+        throw DOMException(DOMException::NOT_FOUND_ERR, 0, GetDOMNodeMemoryManager);
 
     ((DOMAttrImpl *)attr)->addAttrToIDNodeMap();
 
@@ -305,7 +304,7 @@ void DOMElementImpl::setIdAttributeNode(const DOMAttr *idAttr) {
 
     if (fNode.isReadOnly())
         throw DOMException(
-        DOMException::NO_MODIFICATION_ALLOWED_ERR, 0);
+        DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager);
 
     DOMAttr *attr;
     const XMLCh* localName = idAttr->getLocalName();
@@ -315,7 +314,7 @@ void DOMElementImpl::setIdAttributeNode(const DOMAttr *idAttr) {
         attr = getAttributeNode(idAttr->getName());
     
     if(!attr) 
-        throw DOMException(DOMException::NOT_FOUND_ERR, 0);
+        throw DOMException(DOMException::NOT_FOUND_ERR, 0, GetDOMNodeMemoryManager);
 
     ((DOMAttrImpl *)attr)->addAttrToIDNodeMap();
 }
@@ -325,10 +324,10 @@ DOMAttr * DOMElementImpl::setAttributeNode(DOMAttr *newAttr)
 {
     if (fNode.isReadOnly())
         throw DOMException(
-        DOMException::NO_MODIFICATION_ALLOWED_ERR, 0);
+        DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager);
 
     if (newAttr->getNodeType() != DOMNode::ATTRIBUTE_NODE)
-        throw DOMException(DOMException::WRONG_DOCUMENT_ERR, 0);
+        throw DOMException(DOMException::WRONG_DOCUMENT_ERR, 0, GetDOMNodeMemoryManager);
         // revisit.  Exception doesn't match test.
 
     // This will throw INUSE if necessary
@@ -367,7 +366,7 @@ void DOMElementImpl::setAttributeNS(const XMLCh *fNamespaceURI,
 {
     if (fNode.isReadOnly())
         throw DOMException(
-        DOMException::NO_MODIFICATION_ALLOWED_ERR, 0);
+        DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager);
 
     DOMAttr* newAttr = getAttributeNodeNS(fNamespaceURI, qualifiedName);
 
@@ -386,7 +385,7 @@ void DOMElementImpl::removeAttributeNS(const XMLCh *fNamespaceURI,
 {
     if (fNode.isReadOnly())
         throw DOMException(
-        DOMException::NO_MODIFICATION_ALLOWED_ERR, 0);
+        DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager);
 
     XMLSSize_t i = fAttributes->findNamePoint(fNamespaceURI, fLocalName);
     if (i >= 0)
@@ -408,10 +407,10 @@ DOMAttr *DOMElementImpl::setAttributeNodeNS(DOMAttr *newAttr)
 {
     if (fNode.isReadOnly())
         throw DOMException(
-            DOMException::NO_MODIFICATION_ALLOWED_ERR, 0);
+            DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager);
 
     if (newAttr -> getOwnerDocument() != this -> getOwnerDocument())
-        throw DOMException(DOMException::WRONG_DOCUMENT_ERR, 0);
+        throw DOMException(DOMException::WRONG_DOCUMENT_ERR, 0, GetDOMNodeMemoryManager);
 
     // This will throw INUSE if necessary
     DOMAttr *oldAttr = (DOMAttr *) fAttributes->setNamedItemNS(newAttr);
@@ -471,10 +470,10 @@ DOMAttr * DOMElementImpl::setDefaultAttributeNode(DOMAttr *newAttr)
 {
     if (fNode.isReadOnly())
         throw DOMException(
-        DOMException::NO_MODIFICATION_ALLOWED_ERR, 0);
+        DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager);
 
     if (newAttr->getNodeType() != DOMNode::ATTRIBUTE_NODE)
-        throw DOMException(DOMException::WRONG_DOCUMENT_ERR, 0);
+        throw DOMException(DOMException::WRONG_DOCUMENT_ERR, 0, GetDOMNodeMemoryManager);
         // revisit.  Exception doesn't match test.
 
     // This will throw INUSE if necessary
@@ -489,10 +488,10 @@ DOMAttr *DOMElementImpl::setDefaultAttributeNodeNS(DOMAttr *newAttr)
 {
     if (fNode.isReadOnly())
         throw DOMException(
-            DOMException::NO_MODIFICATION_ALLOWED_ERR, 0);
+            DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager);
 
     if (newAttr -> getOwnerDocument() != this -> getOwnerDocument())
-        throw DOMException(DOMException::WRONG_DOCUMENT_ERR, 0);
+        throw DOMException(DOMException::WRONG_DOCUMENT_ERR, 0, GetDOMNodeMemoryManager);
 
     // This will throw INUSE if necessary
     DOMAttr *oldAttr = (DOMAttr *) fDefaultAttributes->setNamedItemNS(newAttr);
@@ -504,7 +503,7 @@ DOMAttr *DOMElementImpl::setDefaultAttributeNodeNS(DOMAttr *newAttr)
 void DOMElementImpl::release()
 {
     if (fNode.isOwned() && !fNode.isToBeReleased())
-        throw DOMException(DOMException::INVALID_ACCESS_ERR,0);
+        throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager);
 
     DOMDocumentImpl* doc = (DOMDocumentImpl*) getOwnerDocument();
     if (doc) {
@@ -514,7 +513,7 @@ void DOMElementImpl::release()
     }
     else {
         // shouldn't reach here
-        throw DOMException(DOMException::INVALID_ACCESS_ERR,0);
+        throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager);
     }
 }
 
diff --git a/src/xercesc/dom/impl/DOMElementNSImpl.cpp b/src/xercesc/dom/impl/DOMElementNSImpl.cpp
index 70247a4de7f5a57333f8f411e0fe4ab9ca4da247..bfe3e1b642ca6e65848205619af5033cc667c532 100644
--- a/src/xercesc/dom/impl/DOMElementNSImpl.cpp
+++ b/src/xercesc/dom/impl/DOMElementNSImpl.cpp
@@ -67,7 +67,6 @@
 
 XERCES_CPP_NAMESPACE_BEGIN
 
-
 DOMElementNSImpl::DOMElementNSImpl(DOMDocument *ownerDoc, const XMLCh *nam) :
     DOMElementImpl(ownerDoc, nam)
 {
@@ -154,13 +153,12 @@ void DOMElementNSImpl::setPrefix(const XMLCh *prefix)
     const XMLCh * xmlURI   = DOMNodeImpl::getXmlURIString();
 
     if (fNode.isReadOnly())
-        throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR,
-                               0);
+        throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager);
     if(prefix != 0 && !((DOMDocumentImpl *)this->getOwnerDocument())->isXMLName(prefix))
-        throw DOMException(DOMException::INVALID_CHARACTER_ERR,0);
+        throw DOMException(DOMException::INVALID_CHARACTER_ERR,0, GetDOMNodeMemoryManager);
 
     if (fNamespaceURI == 0 || fNamespaceURI[0] == chNull)
-        throw DOMException(DOMException::NAMESPACE_ERR, 0);
+        throw DOMException(DOMException::NAMESPACE_ERR, 0, GetDOMNodeMemoryManager);
 
     if (prefix == 0 || *prefix == 0) {
         fName = fLocalName;
@@ -169,11 +167,11 @@ void DOMElementNSImpl::setPrefix(const XMLCh *prefix)
 
     if (XMLString::equals(prefix, xml) &&
         !XMLString::equals(fNamespaceURI, xmlURI))
-        throw DOMException(DOMException::NAMESPACE_ERR, 0);
+        throw DOMException(DOMException::NAMESPACE_ERR, 0, GetDOMNodeMemoryManager);
 
 
     if (XMLString::indexOf(prefix, chColon) != -1) {
-        throw DOMException(DOMException::NAMESPACE_ERR, 0);
+        throw DOMException(DOMException::NAMESPACE_ERR, 0, GetDOMNodeMemoryManager);
     }
 
     this-> fPrefix = ((DOMDocumentImpl *)this->getOwnerDocument())->getPooledString(prefix);
@@ -207,7 +205,7 @@ void DOMElementNSImpl::setPrefix(const XMLCh *prefix)
 void DOMElementNSImpl::release()
 {
     if (fNode.isOwned() && !fNode.isToBeReleased())
-        throw DOMException(DOMException::INVALID_ACCESS_ERR,0);
+        throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager);
 
     DOMDocumentImpl* doc = (DOMDocumentImpl*) getOwnerDocument();
     if (doc) {
@@ -217,7 +215,7 @@ void DOMElementNSImpl::release()
     }
     else {
         // shouldn't reach here
-        throw DOMException(DOMException::INVALID_ACCESS_ERR,0);
+        throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager);
     }
 }
 
@@ -236,7 +234,7 @@ void DOMElementNSImpl::setName(const XMLCh *namespaceURI,
 
     int index = DOMDocumentImpl::indexofQualifiedName(qualifiedName);
     if (index < 0)
-        throw DOMException(DOMException::NAMESPACE_ERR, 0);
+        throw DOMException(DOMException::NAMESPACE_ERR, 0, GetDOMNodeMemoryManager);
 
     if (index == 0) {	//qualifiedName contains no ':'
         this -> fPrefix = 0;
@@ -262,7 +260,7 @@ void DOMElementNSImpl::setName(const XMLCh *namespaceURI,
 
         // Before we carry on, we should check if the prefix or localName are valid XMLName
         if (!((DOMDocumentImpl *)this->getOwnerDocument())->isXMLName(fPrefix) || !((DOMDocumentImpl *)this->getOwnerDocument())->isXMLName(fLocalName))
-            throw DOMException(DOMException::NAMESPACE_ERR, 0);
+            throw DOMException(DOMException::NAMESPACE_ERR, 0, GetDOMNodeMemoryManager);
     }
 
     // DOM Level 3: namespace URI is never empty string.
diff --git a/src/xercesc/dom/impl/DOMEntityImpl.cpp b/src/xercesc/dom/impl/DOMEntityImpl.cpp
index 34c9ca7d9b077b93c6ed3eb324c2bd18af1b9e7c..f99fd3845930fef0805b94951cce22aba749af73 100644
--- a/src/xercesc/dom/impl/DOMEntityImpl.cpp
+++ b/src/xercesc/dom/impl/DOMEntityImpl.cpp
@@ -66,7 +66,6 @@
 
 XERCES_CPP_NAMESPACE_BEGIN
 
-
 DOMEntityImpl::DOMEntityImpl(DOMDocument *ownerDoc, const XMLCh *eName)
    : fNode(ownerDoc),
      fParent(ownerDoc),
@@ -251,7 +250,7 @@ bool DOMEntityImpl::hasChildNodes() const
 void DOMEntityImpl::release()
 {
     if (fNode.isOwned() && !fNode.isToBeReleased())
-        throw DOMException(DOMException::INVALID_ACCESS_ERR,0);
+        throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager);
 
     DOMDocumentImpl* doc = (DOMDocumentImpl*) getOwnerDocument();
     if (doc) {
@@ -261,7 +260,7 @@ void DOMEntityImpl::release()
     }
     else {
         // shouldn't reach here
-        throw DOMException(DOMException::INVALID_ACCESS_ERR,0);
+        throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager);
     }
 }
 
diff --git a/src/xercesc/dom/impl/DOMEntityReferenceImpl.cpp b/src/xercesc/dom/impl/DOMEntityReferenceImpl.cpp
index 6c857f5c8ed814b53fd434974a52e0fe75864c4f..06bb38fde7729733fb77ce9e449e2d5e6b711b08 100644
--- a/src/xercesc/dom/impl/DOMEntityReferenceImpl.cpp
+++ b/src/xercesc/dom/impl/DOMEntityReferenceImpl.cpp
@@ -69,7 +69,6 @@
 
 XERCES_CPP_NAMESPACE_BEGIN
 
-
 DOMEntityReferenceImpl::DOMEntityReferenceImpl(DOMDocument *ownerDoc,
                                          const XMLCh *entityName)
     : fNode(ownerDoc), fParent(ownerDoc), fBaseURI(0)
@@ -184,7 +183,7 @@ void DOMEntityReferenceImpl::setNodeValue(const XMLCh *x)
 void DOMEntityReferenceImpl::setReadOnly(bool readOnl,bool deep)
 {
     if(((DOMDocumentImpl *)getOwnerDocument())->getErrorChecking() && readOnl==false)
-        throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0);
+        throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager);
     fNode.setReadOnly(readOnl,deep);
 }
 
@@ -192,7 +191,7 @@ void DOMEntityReferenceImpl::setReadOnly(bool readOnl,bool deep)
 void DOMEntityReferenceImpl::release()
 {
     if (fNode.isOwned() && !fNode.isToBeReleased())
-        throw DOMException(DOMException::INVALID_ACCESS_ERR,0);
+        throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager);
 
     DOMDocumentImpl* doc = (DOMDocumentImpl*) getOwnerDocument();
     if (doc) {
@@ -202,7 +201,7 @@ void DOMEntityReferenceImpl::release()
     }
     else {
         // shouldn't reach here
-        throw DOMException(DOMException::INVALID_ACCESS_ERR,0);
+        throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager);
     }
 }
 
diff --git a/src/xercesc/dom/impl/DOMErrorImpl.cpp b/src/xercesc/dom/impl/DOMErrorImpl.cpp
index 460fa37d18e5e280c82ecc76c8bc4c0916fdcc4c..697d9c82d7d01fef66d2372d2fc373f65cda0cee 100644
--- a/src/xercesc/dom/impl/DOMErrorImpl.cpp
+++ b/src/xercesc/dom/impl/DOMErrorImpl.cpp
@@ -56,6 +56,9 @@
 
 /*
  * $Log$
+ * Revision 1.9  2004/04/01 22:05:32  peiyongz
+ * invoke DOMException with Memory Manager
+ *
  * Revision 1.8  2004/01/29 11:44:26  cargilld
  * Code cleanup changes to get rid of various compiler diagnostic messages.
  *
@@ -148,6 +151,8 @@ void DOMErrorImpl::setLocation(DOMLocator* const location)
 void DOMErrorImpl::setRelatedException(void*) const
 {
     throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0);
+    //pending: if default value is 0
+    //throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0, XMLPlatformUtils::fgMemoryManager);
 }
 
 XERCES_CPP_NAMESPACE_END
diff --git a/src/xercesc/dom/impl/DOMImplementationImpl.cpp b/src/xercesc/dom/impl/DOMImplementationImpl.cpp
index 77731129a286f53617dabc81079464f8ee5f0521..e59e54ee56734a3ce19f2b2c0630d5f81b559aac 100644
--- a/src/xercesc/dom/impl/DOMImplementationImpl.cpp
+++ b/src/xercesc/dom/impl/DOMImplementationImpl.cpp
@@ -239,7 +239,11 @@ DOMDocumentType *DOMImplementationImpl::createDocumentType(const XMLCh *qualifie
 {
     // assume XML 1.0 since we do not know its version yet.
     if(!XMLChar1_0::isValidName(qualifiedName, XMLString::stringLen(qualifiedName)))
-        throw DOMException(DOMException::INVALID_CHARACTER_ERR,0);
+        throw DOMException(DOMException::INVALID_CHARACTER_ERR, 0);
+        //pending: if default value is 0
+        //throw DOMException(DOMException::INVALID_CHARACTER_ERR, 0, XMLPlatformUtils::fgMemoryManager);
+
+    //to do: do we need to create with user's memorymanager???
     DOMDocumentTypeImpl* docType = new DOMDocumentTypeImpl(0, qualifiedName, publicId, systemId, true);
     return docType;
 }
@@ -255,6 +259,8 @@ DOMDocument *DOMImplementationImpl::createDocument(const XMLCh *namespaceURI,
 //Introduced in DOM Level 3
 DOMImplementation* DOMImplementationImpl::getInterface(const XMLCh*){
     throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0);
+    //pending: if default value is 0
+    //throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0, XMLPlatformUtils::fgMemoryManager);
     return 0;
 }
 
@@ -305,7 +311,7 @@ DOMBuilder* DOMImplementationImpl::createDOMBuilder(const short           mode,
                                                     XMLGrammarPool* const gramPool)
 {
     if (mode == DOMImplementationLS::MODE_ASYNCHRONOUS)
-        throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0);
+        throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0, manager);
 
     return new (manager) DOMBuilderImpl(0, manager, gramPool);
 }
@@ -319,6 +325,8 @@ DOMWriter* DOMImplementationImpl::createDOMWriter(MemoryManager* const manager)
 DOMInputSource* DOMImplementationImpl::createDOMInputSource()
 {
     throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0);
+    //pending: if default value is 0
+    //throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0, XMLPlatformUtils::fgMemoryManager);
     return 0;
 }
 
diff --git a/src/xercesc/dom/impl/DOMNamedNodeMapImpl.cpp b/src/xercesc/dom/impl/DOMNamedNodeMapImpl.cpp
index 8dc4d2cceebd8ffd2cc69b78602e4feb67f43304..5e7e8f264ebd8ac70968776dfc60796066c08119 100644
--- a/src/xercesc/dom/impl/DOMNamedNodeMapImpl.cpp
+++ b/src/xercesc/dom/impl/DOMNamedNodeMapImpl.cpp
@@ -72,7 +72,6 @@
 
 XERCES_CPP_NAMESPACE_BEGIN
 
-
 DOMNamedNodeMapImpl::DOMNamedNodeMapImpl(DOMNode *ownerNod)
 {
     fOwnerNode=ownerNod;
@@ -162,11 +161,11 @@ DOMNode * DOMNamedNodeMapImpl::removeNamedItem(const XMLCh *name)
 {
     if (this->readOnly())
         throw DOMException(
-            DOMException::NO_MODIFICATION_ALLOWED_ERR, 0);
+            DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNamedNodeMapMemoryManager);
     
     unsigned int hash=XMLString::hash(name,MAP_SIZE);
     if(fBuckets[hash]==0)
-        throw DOMException(DOMException::NOT_FOUND_ERR, 0);
+        throw DOMException(DOMException::NOT_FOUND_ERR, 0, GetDOMNamedNodeMapMemoryManager);
 
     int i = 0;
     int size = fBuckets[hash]->size();
@@ -180,7 +179,7 @@ DOMNode * DOMNamedNodeMapImpl::removeNamedItem(const XMLCh *name)
         }
     }
 
-    throw DOMException(DOMException::NOT_FOUND_ERR, 0);
+    throw DOMException(DOMException::NOT_FOUND_ERR, 0, GetDOMNamedNodeMapMemoryManager);
     return 0;
 }
 
@@ -200,11 +199,11 @@ DOMNode * DOMNamedNodeMapImpl::setNamedItem(DOMNode * arg)
     DOMDocument *doc = fOwnerNode->getOwnerDocument();
     DOMNodeImpl *argImpl = castToNodeImpl(arg);
     if(argImpl->getOwnerDocument() != doc)
-        throw DOMException(DOMException::WRONG_DOCUMENT_ERR,0);
+        throw DOMException(DOMException::WRONG_DOCUMENT_ERR,0, GetDOMNamedNodeMapMemoryManager);
     if (this->readOnly())
-        throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0);
+        throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNamedNodeMapMemoryManager);
     if ((arg->getNodeType() == DOMNode::ATTRIBUTE_NODE) && argImpl->isOwned() && (argImpl->fOwnerNode != fOwnerNode))
-        throw DOMException(DOMException::INUSE_ATTRIBUTE_ERR,0);
+        throw DOMException(DOMException::INUSE_ATTRIBUTE_ERR,0, GetDOMNamedNodeMapMemoryManager);
 
     argImpl->fOwnerNode = fOwnerNode;
     argImpl->isOwned(true);
@@ -289,11 +288,11 @@ DOMNode * DOMNamedNodeMapImpl::setNamedItemNS(DOMNode *arg)
     DOMDocument *doc = fOwnerNode->getOwnerDocument();
     DOMNodeImpl *argImpl = castToNodeImpl(arg);
     if (argImpl->getOwnerDocument() != doc)
-        throw DOMException(DOMException::WRONG_DOCUMENT_ERR,0);
+        throw DOMException(DOMException::WRONG_DOCUMENT_ERR,0, GetDOMNamedNodeMapMemoryManager);
     if (this->readOnly())
-        throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0);
+        throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNamedNodeMapMemoryManager);
     if (argImpl->isOwned())
-        throw DOMException(DOMException::INUSE_ATTRIBUTE_ERR,0);
+        throw DOMException(DOMException::INUSE_ATTRIBUTE_ERR,0, GetDOMNamedNodeMapMemoryManager);
 
     argImpl->fOwnerNode = fOwnerNode;
     argImpl->isOwned(true);
@@ -341,7 +340,7 @@ DOMNode *DOMNamedNodeMapImpl::removeNamedItemNS(const XMLCh *namespaceURI,
 {
     if (this->readOnly())
         throw DOMException(
-        DOMException::NO_MODIFICATION_ALLOWED_ERR, 0);
+        DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNamedNodeMapMemoryManager);
 
     // the map is indexed using the full name of nodes; to search given a namespace and a local name
     // we have to do a linear search
@@ -369,7 +368,7 @@ DOMNode *DOMNamedNodeMapImpl::removeNamedItemNS(const XMLCh *namespaceURI,
             }
         }
     }
-    throw DOMException(DOMException::NOT_FOUND_ERR, 0);
+    throw DOMException(DOMException::NOT_FOUND_ERR, 0, GetDOMNamedNodeMapMemoryManager);
     return 0;
 }
 
diff --git a/src/xercesc/dom/impl/DOMNodeImpl.cpp b/src/xercesc/dom/impl/DOMNodeImpl.cpp
index 6f9cef9869a2e2d0bed821a09f64e5c0f4b82255..f661f4514a85d7de7c6f8eceb00056398d770c6f 100644
--- a/src/xercesc/dom/impl/DOMNodeImpl.cpp
+++ b/src/xercesc/dom/impl/DOMNodeImpl.cpp
@@ -80,6 +80,8 @@
 
 XERCES_CPP_NAMESPACE_BEGIN
 
+//Though DOMNodeImpl does not derivate from DOMNode, it shares
+//the same GetDOMNodeMemoryManager
 
 const unsigned short DOMNodeImpl::READONLY     = 0x1<<0;
 const unsigned short DOMNodeImpl::SYNCDATA     = 0x1<<1;
@@ -142,7 +144,7 @@ DOMNode * DOMNodeImpl::appendChild(DOMNode *)
 {
     // Only node types that don't allow children will use this default function.
     //   Others will go to DOMParentNode::appendChild.
-    throw DOMException(DOMException::HIERARCHY_REQUEST_ERR,0);
+    throw DOMException(DOMException::HIERARCHY_REQUEST_ERR,0, GetDOMNodeMemoryManager);
     return 0;
     //  return insertBefore(newChild, 0);
 }
@@ -266,21 +268,21 @@ bool DOMNodeImpl::hasChildNodes() const
 
 
 DOMNode *DOMNodeImpl::insertBefore(DOMNode *, DOMNode *) {
-    throw DOMException(DOMException::HIERARCHY_REQUEST_ERR, 0);
+    throw DOMException(DOMException::HIERARCHY_REQUEST_ERR, 0, GetDOMNodeMemoryManager);
     return 0;
 }
 
 
 DOMNode *DOMNodeImpl::removeChild(DOMNode *)
 {
-    throw DOMException(DOMException::NOT_FOUND_ERR, 0);
+    throw DOMException(DOMException::NOT_FOUND_ERR, 0, GetDOMNodeMemoryManager);
     return 0;
 }
 
 
 DOMNode *DOMNodeImpl::replaceChild(DOMNode *, DOMNode *)
 {
-    throw DOMException(DOMException::HIERARCHY_REQUEST_ERR,0);
+    throw DOMException(DOMException::HIERARCHY_REQUEST_ERR,0, GetDOMNodeMemoryManager);
     return 0;
 }
 
@@ -353,7 +355,7 @@ const XMLCh *DOMNodeImpl::getLocalName() const
 
 void DOMNodeImpl::setPrefix(const XMLCh *)
 {
-    throw DOMException(DOMException::NAMESPACE_ERR, 0);
+    throw DOMException(DOMException::NAMESPACE_ERR, 0, GetDOMNodeMemoryManager);
 }
 
 
@@ -389,12 +391,18 @@ const XMLCh* DOMNodeImpl::mapPrefix(const XMLCh *prefix,
         if (XMLString::equals(namespaceURI, XMLUni::fgXMLURIName))
             return XMLUni::fgXMLURIName;
         throw DOMException(DOMException::NAMESPACE_ERR, 0);
+        //pending: if default value is 0
+        //throw DOMException(DOMException::NAMESPACE_ERR, 0, XMLPlatformUtils::fgMemoryManager);
     } else if (nType == DOMNode::ATTRIBUTE_NODE && XMLString::equals(prefix, XMLUni::fgXMLNSString)) {
         if (XMLString::equals(namespaceURI, XMLUni::fgXMLNSURIName))
             return XMLUni::fgXMLNSURIName;
         throw DOMException(DOMException::NAMESPACE_ERR, 0);
+        //pending: if default value is 0
+        //throw DOMException(DOMException::NAMESPACE_ERR, 0, XMLPlatformUtils::fgMemoryManager);
     } else if (namespaceURI == 0 || *namespaceURI == 0) {
         throw DOMException(DOMException::NAMESPACE_ERR, 0);
+        //pending: if default value is 0
+        //throw DOMException(DOMException::NAMESPACE_ERR, 0, XMLPlatformUtils::fgMemoryManager);
     } else
         return namespaceURI;
     return namespaceURI;
@@ -1039,7 +1047,7 @@ void DOMNodeImpl::setTextContent(const XMLCh* textContent){
         case DOMNode::DOCUMENT_FRAGMENT_NODE:
             {
                 if (isReadOnly())
-                  throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0);
+                  throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager);
 
                 // Remove all childs
                 DOMNode* current = thisNode->getFirstChild();
@@ -1063,7 +1071,7 @@ void DOMNodeImpl::setTextContent(const XMLCh* textContent){
         case DOMNode::COMMENT_NODE:
         case DOMNode::PROCESSING_INSTRUCTION_NODE:
             if (isReadOnly())
-                throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0);
+                throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager);
 
             thisNode->setNodeValue(textContent);
             break;
@@ -1074,7 +1082,7 @@ void DOMNodeImpl::setTextContent(const XMLCh* textContent){
             break;
 
         default:
-            throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0);
+            throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0, GetDOMNodeMemoryManager);
     }
 }
 
@@ -1135,7 +1143,7 @@ bool DOMNodeImpl::isDefaultNamespace(const XMLCh* namespaceURI) const{
 }
 
 DOMNode*         DOMNodeImpl::getInterface(const XMLCh*)      {
-    throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0);
+    throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0, GetDOMNodeMemoryManager);
     return 0;
 }
 
@@ -1144,7 +1152,7 @@ DOMNode*         DOMNodeImpl::getInterface(const XMLCh*)      {
 void DOMNodeImpl::release()
 {
     // shouldn't reach here
-    throw DOMException(DOMException::INVALID_ACCESS_ERR,0);
+    throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager);
 }
 
 XERCES_CPP_NAMESPACE_END
diff --git a/src/xercesc/dom/impl/DOMNodeIteratorImpl.cpp b/src/xercesc/dom/impl/DOMNodeIteratorImpl.cpp
index f5295bf56362004ca851c58c62a22392d2ae0c91..bb3b51edaddec96f15f784070a4950974247b569 100644
--- a/src/xercesc/dom/impl/DOMNodeIteratorImpl.cpp
+++ b/src/xercesc/dom/impl/DOMNodeIteratorImpl.cpp
@@ -70,7 +70,6 @@
 
 XERCES_CPP_NAMESPACE_BEGIN
 
-
 //////////////////////////////////////////////////////////////////////
 // Construction/Destruction
 //////////////////////////////////////////////////////////////////////
@@ -166,7 +165,7 @@ bool DOMNodeIteratorImpl::getExpandEntityReferences()
 
 DOMNode* DOMNodeIteratorImpl::nextNode () {
 	if (fDetached)
-		throw DOMException(DOMException::INVALID_STATE_ERR, 0);
+		throw DOMException(DOMException::INVALID_STATE_ERR, 0, GetDOMNodeIteratorMemoryManager);
 
     // if root is 0 there is no next node->
     if (!fRoot)
@@ -211,7 +210,7 @@ DOMNode* DOMNodeIteratorImpl::nextNode () {
 
 DOMNode* DOMNodeIteratorImpl::previousNode () {
 	if (fDetached)
-		throw DOMException(DOMException::INVALID_STATE_ERR, 0);
+		throw DOMException(DOMException::INVALID_STATE_ERR, 0, GetDOMNodeIteratorMemoryManager);
 		
     // if the root is 0, or the current node is 0, return 0.
     if (!fRoot || !fCurrentNode) return 0;
@@ -252,7 +251,7 @@ DOMNode* DOMNodeIteratorImpl::previousNode () {
 /** The node is accepted if it passes the whatToShow and the filter. */
 bool DOMNodeIteratorImpl::acceptNode (DOMNode* node) {
 	if (fDetached)
-		throw DOMException(DOMException::INVALID_STATE_ERR, 0);
+		throw DOMException(DOMException::INVALID_STATE_ERR, 0, GetDOMNodeIteratorMemoryManager);
 
     if (fNodeFilter == 0) {
         return ((fWhatToShow & (1 << (node->getNodeType() - 1))) != 0);
@@ -283,7 +282,7 @@ DOMNode* DOMNodeIteratorImpl::matchNodeOrParent (DOMNode* node) {
 
 DOMNode* DOMNodeIteratorImpl::nextNode (DOMNode* node, bool visitChildren) {
 	if (fDetached)
-		throw DOMException(DOMException::INVALID_STATE_ERR, 0);
+		throw DOMException(DOMException::INVALID_STATE_ERR, 0, GetDOMNodeIteratorMemoryManager);
 
     if (!node) return fRoot;
 
@@ -326,7 +325,7 @@ DOMNode* DOMNodeIteratorImpl::nextNode (DOMNode* node, bool visitChildren) {
 
 DOMNode* DOMNodeIteratorImpl::previousNode (DOMNode* node) {
 	if (fDetached)
-		throw DOMException(DOMException::INVALID_STATE_ERR, 0);
+		throw DOMException(DOMException::INVALID_STATE_ERR, 0, GetDOMNodeIteratorMemoryManager);
 
     DOMNode* result = 0;
 
@@ -359,7 +358,7 @@ DOMNode* DOMNodeIteratorImpl::previousNode (DOMNode* node) {
 
 void DOMNodeIteratorImpl::removeNode (DOMNode* node) {
 	if (fDetached)
-		throw DOMException(DOMException::INVALID_STATE_ERR, 0);
+		throw DOMException(DOMException::INVALID_STATE_ERR, 0, GetDOMNodeIteratorMemoryManager);
 
     // Implementation note: Fix-up means setting the current node properly
     // after a remove.
diff --git a/src/xercesc/dom/impl/DOMNotationImpl.cpp b/src/xercesc/dom/impl/DOMNotationImpl.cpp
index 69478dfa08cc0db1a6996115347494f39055f10d..1f9bba81e9799c04b010be750e9aece1c4e84ddd 100644
--- a/src/xercesc/dom/impl/DOMNotationImpl.cpp
+++ b/src/xercesc/dom/impl/DOMNotationImpl.cpp
@@ -65,7 +65,6 @@
 
 XERCES_CPP_NAMESPACE_BEGIN
 
-
 DOMNotationImpl::DOMNotationImpl(DOMDocument *ownerDoc, const XMLCh *nName)
     : fNode(ownerDoc), fName(0), fPublicId(0), fSystemId(0), fBaseURI(0)
 {
@@ -127,7 +126,7 @@ void DOMNotationImpl::setPublicId(const XMLCh *arg)
 {
     if(fNode.isReadOnly())
         throw DOMException(
-        DOMException::NO_MODIFICATION_ALLOWED_ERR,0);
+        DOMException::NO_MODIFICATION_ALLOWED_ERR,0, GetDOMNodeMemoryManager);
 
     fPublicId = ((DOMDocumentImpl *)getOwnerDocument())->cloneString(arg);
 }
@@ -137,7 +136,7 @@ void DOMNotationImpl::setSystemId(const XMLCh *arg)
 {
     if(fNode.isReadOnly())
         throw DOMException(
-        DOMException::NO_MODIFICATION_ALLOWED_ERR,0);
+        DOMException::NO_MODIFICATION_ALLOWED_ERR,0, GetDOMNodeMemoryManager);
 
     fSystemId = ((DOMDocumentImpl *)getOwnerDocument())->cloneString(arg);
 }
@@ -145,7 +144,7 @@ void DOMNotationImpl::setSystemId(const XMLCh *arg)
 void DOMNotationImpl::release()
 {
     if (fNode.isOwned() && !fNode.isToBeReleased())
-        throw DOMException(DOMException::INVALID_ACCESS_ERR,0);
+        throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager);
 
     DOMDocumentImpl* doc = (DOMDocumentImpl*) getOwnerDocument();
     if (doc) {
@@ -154,7 +153,7 @@ void DOMNotationImpl::release()
     }
     else {
         // shouldn't reach here
-        throw DOMException(DOMException::INVALID_ACCESS_ERR,0);
+        throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager);
     }
 }
 
diff --git a/src/xercesc/dom/impl/DOMParentNode.cpp b/src/xercesc/dom/impl/DOMParentNode.cpp
index 426228fd169b58cd6ab084399fa203087ddc96a6..97b6363ba49091aeaca8612d8b560a57040c30c7 100644
--- a/src/xercesc/dom/impl/DOMParentNode.cpp
+++ b/src/xercesc/dom/impl/DOMParentNode.cpp
@@ -71,7 +71,6 @@
 
 XERCES_CPP_NAMESPACE_BEGIN
 
-
 DOMParentNode::DOMParentNode(DOMDocument *ownerDoc)
     : fOwnerDocument(ownerDoc), fFirstChild(0), fChildNodeList(castToNode(this))
 {    
@@ -182,10 +181,10 @@ bool DOMParentNode::hasChildNodes() const
 DOMNode *DOMParentNode::insertBefore(DOMNode *newChild, DOMNode *refChild) {
     DOMNodeImpl *thisNodeImpl = castToNodeImpl(this);
     if (thisNodeImpl->isReadOnly())
-        throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0);
+        throw DOMException(DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMParentNodeMemoryManager);
 
     if (newChild->getOwnerDocument() != fOwnerDocument)
-        throw DOMException(DOMException::WRONG_DOCUMENT_ERR, 0);
+        throw DOMException(DOMException::WRONG_DOCUMENT_ERR, 0, GetDOMParentNodeMemoryManager);
 
     // Prevent cycles in the tree
     //only need to do this if the node has children
@@ -196,12 +195,12 @@ DOMNode *DOMParentNode::insertBefore(DOMNode *newChild, DOMNode *refChild) {
             a=a->getParentNode())
             treeSafe=(newChild!=a);
         if(!treeSafe)
-            throw DOMException(DOMException::HIERARCHY_REQUEST_ERR,0);
+            throw DOMException(DOMException::HIERARCHY_REQUEST_ERR,0, GetDOMParentNodeMemoryManager);
     }
 
     // refChild must in fact be a child of this node (or 0)
     if (refChild!=0 && refChild->getParentNode() != castToNode(this))
-        throw DOMException(DOMException::NOT_FOUND_ERR,0);
+        throw DOMException(DOMException::NOT_FOUND_ERR,0, GetDOMParentNodeMemoryManager);
 
     // if the new node has to be placed before itself, we don't have to do anything 
     // (even worse, we would crash if we continue, as we assume they are two distinct nodes)
@@ -232,14 +231,14 @@ DOMNode *DOMParentNode::insertBefore(DOMNode *newChild, DOMNode *refChild) {
               kid=kid->getNextSibling())
         {
             if (!DOMDocumentImpl::isKidOK(castToNode(this), kid))
-              throw DOMException(DOMException::HIERARCHY_REQUEST_ERR,0);
+              throw DOMException(DOMException::HIERARCHY_REQUEST_ERR,0, GetDOMParentNodeMemoryManager);
         }
         while(newChild->hasChildNodes())     // Move
             insertBefore(newChild->getFirstChild(),refChild);
     }
 
     else if (!DOMDocumentImpl::isKidOK(castToNode(this), newChild))
-        throw DOMException(DOMException::HIERARCHY_REQUEST_ERR,0);
+        throw DOMException(DOMException::HIERARCHY_REQUEST_ERR,0, GetDOMParentNodeMemoryManager);
 
     else
     {
@@ -312,10 +311,10 @@ DOMNode *DOMParentNode::removeChild(DOMNode *oldChild)
 {
     if (castToNodeImpl(this)->isReadOnly())
         throw DOMException(
-        DOMException::NO_MODIFICATION_ALLOWED_ERR, 0);
+        DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMParentNodeMemoryManager);
 
     if (oldChild == 0 || oldChild->getParentNode() != castToNode(this))
-        throw DOMException(DOMException::NOT_FOUND_ERR, 0);
+        throw DOMException(DOMException::NOT_FOUND_ERR, 0, GetDOMParentNodeMemoryManager);
 
     if (this->getOwnerDocument() !=  0  ) {
         //notify iterators
diff --git a/src/xercesc/dom/impl/DOMParentNode.hpp b/src/xercesc/dom/impl/DOMParentNode.hpp
index cc9dcb0bffb38785e2b92ecb1bdc059aa082f40a..f15558f5be36111c1d5016d9432e571be97dd2f3 100644
--- a/src/xercesc/dom/impl/DOMParentNode.hpp
+++ b/src/xercesc/dom/impl/DOMParentNode.hpp
@@ -144,6 +144,8 @@ private:
     DOMParentNode& operator= (const DOMParentNode& other);
 };
 
+#define GetDOMParentNodeMemoryManager GET_DIRECT_MM(fOwnerDocument)
+
 XERCES_CPP_NAMESPACE_END
 
 #endif
diff --git a/src/xercesc/dom/impl/DOMProcessingInstructionImpl.cpp b/src/xercesc/dom/impl/DOMProcessingInstructionImpl.cpp
index c5778780c443264111b3d1422583e1e22b80b49b..272e7dcc1e859894b16f946a00fc70f37078a459 100644
--- a/src/xercesc/dom/impl/DOMProcessingInstructionImpl.cpp
+++ b/src/xercesc/dom/impl/DOMProcessingInstructionImpl.cpp
@@ -69,7 +69,6 @@
 
 XERCES_CPP_NAMESPACE_BEGIN
 
-
 DOMProcessingInstructionImpl::DOMProcessingInstructionImpl(DOMDocument *ownerDoc,
                                                      const XMLCh *targt,
                                                      const XMLCh *dat)
@@ -133,7 +132,7 @@ const XMLCh * DOMProcessingInstructionImpl::getTarget() const
 void DOMProcessingInstructionImpl::release()
 {
     if (fNode.isOwned() && !fNode.isToBeReleased())
-        throw DOMException(DOMException::INVALID_ACCESS_ERR,0);
+        throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager);
 
     DOMDocumentImpl* doc = (DOMDocumentImpl*) getOwnerDocument();
     if (doc) {
@@ -143,7 +142,7 @@ void DOMProcessingInstructionImpl::release()
     }
     else {
         // shouldn't reach here
-        throw DOMException(DOMException::INVALID_ACCESS_ERR,0);
+        throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager);
     }
 }
 
@@ -162,11 +161,11 @@ DOMProcessingInstruction *DOMProcessingInstructionImpl::splitText(XMLSize_t offs
     if (fNode.isReadOnly())
     {
         throw DOMException(
-            DOMException::NO_MODIFICATION_ALLOWED_ERR, 0);
+            DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager);
     }
     XMLSize_t len = fCharacterData.fDataBuf->getLen();
     if (offset > len || offset < 0)
-        throw DOMException(DOMException::INDEX_SIZE_ERR, 0);
+        throw DOMException(DOMException::INDEX_SIZE_ERR, 0,  GetDOMNodeMemoryManager);
 
     DOMProcessingInstruction *newText =
                 getOwnerDocument()->createProcessingInstruction(fTarget,
diff --git a/src/xercesc/dom/impl/DOMRangeImpl.cpp b/src/xercesc/dom/impl/DOMRangeImpl.cpp
index 346658eb3f5500252934bf04d84dde302f9391f0..c609f8350f2faf5d9580da5ded29838be97b9d00 100644
--- a/src/xercesc/dom/impl/DOMRangeImpl.cpp
+++ b/src/xercesc/dom/impl/DOMRangeImpl.cpp
@@ -123,7 +123,7 @@ DOMNode* DOMRangeImpl::getStartContainer() const
     if (fDetached)
     {
         throw DOMException(
-            DOMException::INVALID_STATE_ERR, 0);
+            DOMException::INVALID_STATE_ERR, 0, fMemoryManager);
     }
 
     return fStartContainer;
@@ -134,7 +134,7 @@ XMLSize_t DOMRangeImpl::getStartOffset() const
     if (fDetached)
     {
         throw DOMException(
-            DOMException::INVALID_STATE_ERR, 0);
+            DOMException::INVALID_STATE_ERR, 0, fMemoryManager);
     }
 
     return fStartOffset;
@@ -145,7 +145,7 @@ DOMNode* DOMRangeImpl::getEndContainer() const
     if (fDetached)
     {
         throw DOMException(
-            DOMException::INVALID_STATE_ERR, 0);
+            DOMException::INVALID_STATE_ERR, 0, fMemoryManager);
     }
 
     return fEndContainer;
@@ -156,7 +156,7 @@ XMLSize_t DOMRangeImpl::getEndOffset() const
     if (fDetached)
     {
         throw DOMException(
-            DOMException::INVALID_STATE_ERR, 0);
+            DOMException::INVALID_STATE_ERR, 0, fMemoryManager);
     }
 
     return fEndOffset;
@@ -169,7 +169,7 @@ bool DOMRangeImpl::getCollapsed() const
     if (fDetached)
     {
         throw DOMException(
-            DOMException::INVALID_STATE_ERR, 0);
+            DOMException::INVALID_STATE_ERR, 0, fMemoryManager);
     }
 
     return ((fStartContainer == fEndContainer)
@@ -185,7 +185,7 @@ void DOMRangeImpl::setStartContainer(const DOMNode* node)
     if (fDetached)
     {
         throw DOMException(
-            DOMException::INVALID_STATE_ERR, 0);
+            DOMException::INVALID_STATE_ERR, 0, fMemoryManager);
     }
 
     fStartContainer = (DOMNode*) node;
@@ -196,7 +196,7 @@ void DOMRangeImpl::setStartOffset(XMLSize_t offset)
     if (fDetached)
     {
         throw DOMException(
-            DOMException::INVALID_STATE_ERR, 0);
+            DOMException::INVALID_STATE_ERR, 0, fMemoryManager);
     }
 
     fStartOffset = offset;
@@ -207,7 +207,7 @@ void DOMRangeImpl::setEndContainer(const DOMNode* node)
     if (fDetached)
     {
         throw DOMException(
-            DOMException::INVALID_STATE_ERR, 0);
+            DOMException::INVALID_STATE_ERR, 0, fMemoryManager);
     }
 
     fEndContainer = (DOMNode*) node;
@@ -219,7 +219,7 @@ void DOMRangeImpl::setEndOffset(XMLSize_t offset)
     if (fDetached)
     {
         throw DOMException(
-            DOMException::INVALID_STATE_ERR, 0);
+            DOMException::INVALID_STATE_ERR, 0, fMemoryManager);
     }
 
     fEndOffset = offset;
@@ -236,7 +236,7 @@ void DOMRangeImpl::setStart(const DOMNode* refNode, XMLSize_t offset)
             collapse(true); //collapse the range positions to start
             fCollapsed = true;
             throw DOMException(
-                DOMException::WRONG_DOCUMENT_ERR, 0);
+                DOMException::WRONG_DOCUMENT_ERR, 0, fMemoryManager);
         }
     }
 
@@ -267,7 +267,7 @@ void DOMRangeImpl::setEnd(const DOMNode* refNode, XMLSize_t offset)
             collapse(false); //collapse the range positions to end
             fCollapsed = true;
             throw DOMException(
-                DOMException::WRONG_DOCUMENT_ERR, 0);
+                DOMException::WRONG_DOCUMENT_ERR, 0, fMemoryManager);
         }
     }
 
@@ -291,11 +291,11 @@ void DOMRangeImpl::setStartBefore(const DOMNode* refNode)
 {
     if( fDetached) {
         throw DOMException(
-            DOMException::INVALID_STATE_ERR, 0);
+            DOMException::INVALID_STATE_ERR, 0, fMemoryManager);
     }
     if ( !hasLegalRootContainer(refNode) || !isLegalContainedNode(refNode)) {
         throw DOMRangeException(
-            DOMRangeException::INVALID_NODE_TYPE_ERR, 0);
+            DOMRangeException::INVALID_NODE_TYPE_ERR, 0, fMemoryManager);
     }
 
     // error if not the same owner document
@@ -304,7 +304,7 @@ void DOMRangeImpl::setStartBefore(const DOMNode* refNode)
             collapse(true); //collapse the range positions to start
             fCollapsed = true;
             throw DOMException(
-                DOMException::WRONG_DOCUMENT_ERR, 0);
+                DOMException::WRONG_DOCUMENT_ERR, 0, fMemoryManager);
         }
     }
 
@@ -335,11 +335,11 @@ void DOMRangeImpl::setStartAfter(const DOMNode* refNode)
 {
     if( fDetached) {
         throw DOMException(
-            DOMException::INVALID_STATE_ERR, 0);
+            DOMException::INVALID_STATE_ERR, 0, fMemoryManager);
     }
     if ( !hasLegalRootContainer(refNode) || !isLegalContainedNode(refNode)) {
         throw DOMRangeException(
-            DOMRangeException::INVALID_NODE_TYPE_ERR, 0);
+            DOMRangeException::INVALID_NODE_TYPE_ERR, 0, fMemoryManager);
     }
 
     // error if not the same owner document
@@ -348,7 +348,7 @@ void DOMRangeImpl::setStartAfter(const DOMNode* refNode)
             collapse(true); //collapse the range positions to start
             fCollapsed = true;
             throw DOMException(
-                DOMException::WRONG_DOCUMENT_ERR, 0);
+                DOMException::WRONG_DOCUMENT_ERR, 0, fMemoryManager);
         }
     }
 
@@ -377,11 +377,11 @@ void DOMRangeImpl::setEndBefore(const DOMNode* refNode)
 {
     if( fDetached) {
         throw DOMException(
-            DOMException::INVALID_STATE_ERR, 0);
+            DOMException::INVALID_STATE_ERR, 0, fMemoryManager);
     }
     if ( !hasLegalRootContainer(refNode) || !isLegalContainedNode(refNode)) {
         throw DOMRangeException(
-            DOMRangeException::INVALID_NODE_TYPE_ERR, 0);
+            DOMRangeException::INVALID_NODE_TYPE_ERR, 0, fMemoryManager);
     }
 
     // error if not the same owner document
@@ -390,7 +390,7 @@ void DOMRangeImpl::setEndBefore(const DOMNode* refNode)
             collapse(false); //collapse the range positions to end
             fCollapsed = true;
             throw DOMException(
-                DOMException::WRONG_DOCUMENT_ERR, 0);
+                DOMException::WRONG_DOCUMENT_ERR, 0, fMemoryManager);
         }
     }
 
@@ -420,11 +420,11 @@ void DOMRangeImpl::setEndAfter(const DOMNode* refNode)
 {
     if( fDetached) {
         throw DOMException(
-            DOMException::INVALID_STATE_ERR, 0);
+            DOMException::INVALID_STATE_ERR, 0, fMemoryManager);
     }
     if ( !hasLegalRootContainer(refNode) || !isLegalContainedNode(refNode)) {
         throw DOMRangeException(
-            DOMRangeException::INVALID_NODE_TYPE_ERR, 0);
+            DOMRangeException::INVALID_NODE_TYPE_ERR, 0, fMemoryManager);
     }
 
     // error if not the same owner document
@@ -433,7 +433,7 @@ void DOMRangeImpl::setEndAfter(const DOMNode* refNode)
             collapse(false); //collapse the range positions to end
             fCollapsed = true;
             throw DOMException(
-                DOMException::WRONG_DOCUMENT_ERR, 0);
+                DOMException::WRONG_DOCUMENT_ERR, 0, fMemoryManager);
         }
     }
 
@@ -465,7 +465,7 @@ void DOMRangeImpl::detach()
 {
     if( fDetached) {
         throw DOMException(
-            DOMException::INVALID_STATE_ERR, 0);
+            DOMException::INVALID_STATE_ERR, 0, fMemoryManager);
     }
 
     ((DOMDocumentImpl *)fDocument)->removeRange(this);
@@ -486,7 +486,7 @@ void DOMRangeImpl::collapse(bool toStart)
 {
     if( fDetached) {
         throw DOMException(
-            DOMException::INVALID_STATE_ERR, 0);
+            DOMException::INVALID_STATE_ERR, 0, fMemoryManager);
     }
 
     if (toStart) {
@@ -504,7 +504,7 @@ void DOMRangeImpl::selectNode(const DOMNode* refNode)
     validateNode(refNode);
     if ( !isLegalContainedNode(refNode)) {
         throw DOMRangeException(
-            DOMRangeException::INVALID_NODE_TYPE_ERR, 0);
+            DOMRangeException::INVALID_NODE_TYPE_ERR, 0, fMemoryManager);
     }
     //First check for the text type node
     short type = refNode->getNodeType();
@@ -583,12 +583,12 @@ void DOMRangeImpl::surroundContents(DOMNode* newParent)
     //check for elimination criteria
     if( fDetached) {
         throw DOMException(
-            DOMException::INVALID_STATE_ERR, 0);
+            DOMException::INVALID_STATE_ERR, 0, fMemoryManager);
     }
 
     if (newParent->getOwnerDocument() !=fDocument) {
         throw DOMException(
-            DOMException::WRONG_DOCUMENT_ERR, 0);
+            DOMException::WRONG_DOCUMENT_ERR, 0, fMemoryManager);
     }
 
     int type = newParent->getNodeType();
@@ -596,7 +596,7 @@ void DOMRangeImpl::surroundContents(DOMNode* newParent)
         || type == DOMNode::DOCUMENT_TYPE_NODE)
     {
         throw DOMRangeException(
-            DOMRangeException::INVALID_NODE_TYPE_ERR, 0);
+            DOMRangeException::INVALID_NODE_TYPE_ERR, 0, fMemoryManager);
     }
 
     DOMNode* realStart = fStartContainer;
@@ -619,7 +619,7 @@ void DOMRangeImpl::surroundContents(DOMNode* newParent)
 
     if (realStart != realEnd) {
         throw DOMRangeException(
-            DOMRangeException::BAD_BOUNDARYPOINTS_ERR, 0);
+            DOMRangeException::BAD_BOUNDARYPOINTS_ERR, 0, fMemoryManager);
     }
 
     DOMDocumentFragment* frag = (DOMDocumentFragment*) extractContents();
@@ -633,11 +633,11 @@ short DOMRangeImpl::compareBoundaryPoints(DOMRange::CompareHow how, const DOMRan
 {
     if (fDocument != ((DOMRangeImpl*)srcRange)->fDocument) {
         throw DOMException(
-            DOMException::WRONG_DOCUMENT_ERR, 0);
+            DOMException::WRONG_DOCUMENT_ERR, 0, fMemoryManager);
     }
     if( fDetached) {
         throw DOMException(
-            DOMException::INVALID_STATE_ERR, 0);
+            DOMException::INVALID_STATE_ERR, 0, fMemoryManager);
     }
 
     DOMNode* pointA;
@@ -757,7 +757,7 @@ void DOMRangeImpl::insertNode(DOMNode* newNode)
 
     if( fDetached) {
         throw DOMException(
-            DOMException::INVALID_STATE_ERR, 0);
+            DOMException::INVALID_STATE_ERR, 0, fMemoryManager);
     }
 
     int type = newNode->getNodeType();
@@ -767,26 +767,26 @@ void DOMRangeImpl::insertNode(DOMNode* newNode)
         || type == DOMNode::DOCUMENT_NODE)
     {
         throw DOMRangeException(
-            DOMRangeException::INVALID_NODE_TYPE_ERR, 0);
+            DOMRangeException::INVALID_NODE_TYPE_ERR, 0, fMemoryManager);
     }
 
     // Prevent cycles in the tree.
     //isKidOK() is not checked here as its taken care by insertBefore() function
     if (isAncestorOf( newNode, fStartContainer)) {
         throw DOMException(
-            DOMException::HIERARCHY_REQUEST_ERR, 0);
+            DOMException::HIERARCHY_REQUEST_ERR, 0, fMemoryManager);
     }
 
     for (DOMNode* aNode = fStartContainer; aNode!=0; aNode = aNode->getParentNode()) {
         if (castToNodeImpl(newNode)->isReadOnly()) {
         throw DOMException(
-            DOMException::NO_MODIFICATION_ALLOWED_ERR, 0);
+            DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, fMemoryManager);
     }
     }
 
     if (fDocument != newNode->getOwnerDocument()) {
         throw DOMException(
-            DOMException::WRONG_DOCUMENT_ERR, 0);
+            DOMException::WRONG_DOCUMENT_ERR, 0, fMemoryManager);
     }
 
 
@@ -840,7 +840,7 @@ DOMRange* DOMRangeImpl::cloneRange() const
 {
     if( fDetached) {
         throw DOMException(
-            DOMException::INVALID_STATE_ERR, 0);
+            DOMException::INVALID_STATE_ERR, 0, fMemoryManager);
     }
 
     DOMRange* range = fDocument->createRange();
@@ -854,7 +854,7 @@ const XMLCh* DOMRangeImpl::toString() const
 {
     if( fDetached) {
         throw DOMException(
-            DOMException::INVALID_STATE_ERR, 0);
+            DOMException::INVALID_STATE_ERR, 0, fMemoryManager);
     }
 
     if ((fStartContainer == fEndContainer) && (fEndOffset == fStartOffset))
@@ -1069,12 +1069,11 @@ void DOMRangeImpl::validateNode(const DOMNode* node) const
 {
     if( fDetached) {
         throw DOMException(
-            DOMException::INVALID_STATE_ERR, 0);
+            DOMException::INVALID_STATE_ERR, 0, fMemoryManager);
     }
 
     if ( !isValidAncestorType(node)) {
-        throw DOMRangeException(
-            DOMRangeException::INVALID_NODE_TYPE_ERR, 0);
+        throw DOMRangeException(DOMRangeException::INVALID_NODE_TYPE_ERR, 0, fMemoryManager);
     }
 }
 
@@ -1082,7 +1081,7 @@ void DOMRangeImpl::validateNode(const DOMNode* node) const
 const DOMNode* DOMRangeImpl::commonAncestorOf(const DOMNode* pointA, const DOMNode* pointB) const
 {
     if (fDetached)
-            throw DOMException(DOMException::INVALID_STATE_ERR, 0);
+        throw DOMException(DOMException::INVALID_STATE_ERR, 0, fMemoryManager);
 
     //if the containers are same then it itself is its common ancestor.
     if (pointA == pointB)
@@ -1122,7 +1121,7 @@ const DOMNode* DOMRangeImpl::commonAncestorOf(const DOMNode* pointA, const DOMNo
 void DOMRangeImpl::checkIndex(const DOMNode* node, XMLSize_t offset) const
 {
     if (offset < 0) {
-        throw DOMException( DOMException::INDEX_SIZE_ERR, 0 );
+        throw DOMException( DOMException::INDEX_SIZE_ERR, 0, fMemoryManager);
     }
 
     short type = node->getNodeType();
@@ -1132,7 +1131,7 @@ void DOMRangeImpl::checkIndex(const DOMNode* node, XMLSize_t offset) const
         || type == DOMNode::COMMENT_NODE
         || type == DOMNode::PROCESSING_INSTRUCTION_NODE)) {
         if (offset > XMLString::stringLen(node->getNodeValue()))
-            throw DOMException( DOMException::INDEX_SIZE_ERR, 0 );
+            throw DOMException( DOMException::INDEX_SIZE_ERR, 0, fMemoryManager );
         else  return;
     }
 
@@ -1142,7 +1141,7 @@ void DOMRangeImpl::checkIndex(const DOMNode* node, XMLSize_t offset) const
         child = child->getNextSibling();
     }
     if (i < offset) {
-        throw DOMException( DOMException::INDEX_SIZE_ERR, 0 );
+        throw DOMException( DOMException::INDEX_SIZE_ERR, 0, fMemoryManager );
     }
 
 }
@@ -1193,7 +1192,7 @@ DOMNode* DOMRangeImpl::nextNode(const DOMNode* node, bool visitChildren) const
 DOMDocumentFragment* DOMRangeImpl::traverseContents(TraversalType how)
 {
     if (fDetached)
-            throw DOMException(DOMException::INVALID_STATE_ERR, 0);
+            throw DOMException(DOMException::INVALID_STATE_ERR, 0, fMemoryManager);
 
     if (fStartContainer == 0 || fEndContainer == 0) {
         return 0; // REVIST: Throw exception?
@@ -1871,7 +1870,7 @@ void DOMRangeImpl::checkReadOnly(DOMNode* start, DOMNode* end,
     if ( type == DOMNode::DOCUMENT_TYPE_NODE )
     {
         throw DOMException(
-            DOMException::HIERARCHY_REQUEST_ERR, 0);
+            DOMException::HIERARCHY_REQUEST_ERR, 0, fMemoryManager);
     }
 
     if((type == DOMNode::TEXT_NODE
@@ -1881,7 +1880,7 @@ void DOMRangeImpl::checkReadOnly(DOMNode* start, DOMNode* end,
     {
         if (castToNodeImpl(start)->isReadOnly()) {
             throw DOMException(
-                DOMException::NO_MODIFICATION_ALLOWED_ERR, 0);
+                DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, fMemoryManager);
         }
         //if both start and end are text check and return
         if (start == end)
@@ -1900,7 +1899,7 @@ void DOMRangeImpl::checkReadOnly(DOMNode* start, DOMNode* end,
     if ( type == DOMNode::DOCUMENT_TYPE_NODE )
     {
         throw DOMException(
-            DOMException::HIERARCHY_REQUEST_ERR, 0);
+            DOMException::HIERARCHY_REQUEST_ERR, 0, fMemoryManager);
     }
 
     if((type == DOMNode::TEXT_NODE
@@ -1928,12 +1927,12 @@ void DOMRangeImpl::recurseTreeAndCheck(DOMNode* start, DOMNode* end)
         if ( node->getNodeType()== DOMNode::DOCUMENT_TYPE_NODE )
         {
             throw DOMException(
-                DOMException::HIERARCHY_REQUEST_ERR, 0);
+                DOMException::HIERARCHY_REQUEST_ERR, 0, fMemoryManager);
         }
 
         if (castToNodeImpl(node)->isReadOnly()) {
             throw DOMException(
-                DOMException::NO_MODIFICATION_ALLOWED_ERR, 0);
+                DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, fMemoryManager);
         }
 
         if (node->hasChildNodes()) {
diff --git a/src/xercesc/dom/impl/DOMTextImpl.cpp b/src/xercesc/dom/impl/DOMTextImpl.cpp
index a3604e07e1945f2a2a48d83a403ff900b37f0004..607270348244bc21c44ce71df27fdf6c56fc2b80 100644
--- a/src/xercesc/dom/impl/DOMTextImpl.cpp
+++ b/src/xercesc/dom/impl/DOMTextImpl.cpp
@@ -76,7 +76,6 @@
 
 XERCES_CPP_NAMESPACE_BEGIN
 
-
 class DOMDocument;
 
 DOMTextImpl::DOMTextImpl(DOMDocument *ownerDoc, const XMLCh *dat)
@@ -119,11 +118,11 @@ DOMText *DOMTextImpl::splitText(XMLSize_t offset)
     if (fNode.isReadOnly())
     {
         throw DOMException(
-            DOMException::NO_MODIFICATION_ALLOWED_ERR, 0);
+            DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMNodeMemoryManager);
     }
     XMLSize_t len = fCharacterData.fDataBuf->getLen();
     if (offset > len || offset < 0)
-        throw DOMException(DOMException::INDEX_SIZE_ERR, 0);
+        throw DOMException(DOMException::INDEX_SIZE_ERR, 0, GetDOMNodeMemoryManager);
 
     DOMText *newText =
                 getOwnerDocument()->createTextNode(
@@ -170,12 +169,12 @@ bool DOMTextImpl::getIsWhitespaceInElementContent() const
 }
 
 const XMLCh* DOMTextImpl::getWholeText() {
-    throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0);
+    throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0, GetDOMNodeMemoryManager);
     return 0;
 }
 
 DOMText* DOMTextImpl::replaceWholeText(const XMLCh*){
-    throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0);
+    throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0, GetDOMNodeMemoryManager);
     return 0;
 }
 
@@ -183,7 +182,7 @@ DOMText* DOMTextImpl::replaceWholeText(const XMLCh*){
 void DOMTextImpl::release()
 {
     if (fNode.isOwned() && !fNode.isToBeReleased())
-        throw DOMException(DOMException::INVALID_ACCESS_ERR,0);
+        throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager);
 
     DOMDocumentImpl* doc = (DOMDocumentImpl*) getOwnerDocument();
     if (doc) {
@@ -193,7 +192,7 @@ void DOMTextImpl::release()
     }
     else {
         // shouldn't reach here
-        throw DOMException(DOMException::INVALID_ACCESS_ERR,0);
+        throw DOMException(DOMException::INVALID_ACCESS_ERR,0, GetDOMNodeMemoryManager);
     }
 }
 
diff --git a/src/xercesc/dom/impl/DOMTreeWalkerImpl.cpp b/src/xercesc/dom/impl/DOMTreeWalkerImpl.cpp
index c86c3ae8310ea882dc1ba499c0f7bd565c70e80e..e2ddbad67a0e60201da9687dc187ab404186633c 100644
--- a/src/xercesc/dom/impl/DOMTreeWalkerImpl.cpp
+++ b/src/xercesc/dom/impl/DOMTreeWalkerImpl.cpp
@@ -66,7 +66,6 @@
 
 XERCES_CPP_NAMESPACE_BEGIN
 
-
 /** constructor */
 DOMTreeWalkerImpl::DOMTreeWalkerImpl (
                                 DOMNode* root,
@@ -142,7 +141,7 @@ DOMNode* DOMTreeWalkerImpl::getCurrentNode () {
 void DOMTreeWalkerImpl::setCurrentNode (DOMNode* node) {
 
     if (!node)
-        throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0);
+        throw DOMException(DOMException::NOT_SUPPORTED_ERR, 0, GetDOMTreeWalkerMemoryManager);
 
     fCurrentNode = node;
 }
diff --git a/src/xercesc/dom/impl/DOMWriterImpl.cpp b/src/xercesc/dom/impl/DOMWriterImpl.cpp
index 7d9dbc388b529b5343b5994bc0912541ff873dad..eca6509e27335205af2a575508cbf729cf7bfa55 100644
--- a/src/xercesc/dom/impl/DOMWriterImpl.cpp
+++ b/src/xercesc/dom/impl/DOMWriterImpl.cpp
@@ -57,6 +57,9 @@
 /*
  * $Id$
  * $Log$
+ * Revision 1.52  2004/04/01 22:05:32  peiyongz
+ * invoke DOMException with Memory Manager
+ *
  * Revision 1.51  2004/01/29 11:44:27  cargilld
  * Code cleanup changes to get rid of various compiler diagnostic messages.
  *
@@ -558,7 +561,7 @@ void DOMWriterImpl::setFeature(const XMLCh* const featName
         }
         XMLString::catString(tmpbuf, gCantSet);
         XMLString::catString(tmpbuf, state? gTrue : gFalse);
-        throw DOMException(DOMException::NOT_SUPPORTED_ERR, tmpbuf);
+        throw DOMException(DOMException::NOT_SUPPORTED_ERR, tmpbuf, fMemoryManager);
     }
     else
         setFeature(featureId, state);
@@ -1506,7 +1509,7 @@ bool DOMWriterImpl::checkFeature(const XMLCh* const featName
     if (!featName || !*featName)
     {
         if (toThrow)
-            throw DOMException(DOMException::NOT_FOUND_ERR, 0);
+            throw DOMException(DOMException::NOT_FOUND_ERR, 0, fMemoryManager);
 
         return false;
     }
@@ -1539,7 +1542,7 @@ bool DOMWriterImpl::checkFeature(const XMLCh* const featName
     if (featureId == INVALID_FEATURE_ID)
     {
         if (toThrow)
-            throw DOMException(DOMException::NOT_FOUND_ERR, featName);
+            throw DOMException(DOMException::NOT_FOUND_ERR, featName, fMemoryManager);
 
         return false;
     }