diff --git a/Projects/OS2/VACPP40/xerces_idom.icc b/Projects/OS2/VACPP40/xerces_idom.icc
index aebd36bad7e1561d858ba71d1f67358e138d8da4..ecd4ccdcfe53183aade224321b5e4ae0c2d185f6 100644
--- a/Projects/OS2/VACPP40/xerces_idom.icc
+++ b/Projects/OS2/VACPP40/xerces_idom.icc
@@ -18,6 +18,7 @@ group xerces_dom =
     BASE_DIR "\\src\\idom\\IDNamedNodeMapImpl.cpp",
     BASE_DIR "\\src\\idom\\IDNodeIDMap.cpp",
     BASE_DIR "\\src\\idom\\IDNodeImpl.cpp",
+    BASE_DIR "\\src\\idom\\IDNodeIteratorImpl.cpp",
     BASE_DIR "\\src\\idom\\IDNodeListImpl.cpp",
     BASE_DIR "\\src\\idom\\IDNodeVector.cpp",
     BASE_DIR "\\src\\idom\\IDNotationImpl.cpp",
@@ -28,4 +29,5 @@ group xerces_dom =
     BASE_DIR "\\src\\idom\\IDRangeImpl.cpp",
     BASE_DIR "\\src\\idom\\IDStringPool.cpp",
     BASE_DIR "\\src\\idom\\IDTextImpl.cpp",
+    BASE_DIR "\\src\\idom\\IDTreeWalkerImpl.cpp",
     BASE_DIR "\\src\\idom\\IDXMLDeclImpl.cpp"
diff --git a/Projects/Win32/VC6/xerces-all/IDOMTraversalTest/IDOMTraversalTest.dsp b/Projects/Win32/VC6/xerces-all/IDOMTraversalTest/IDOMTraversalTest.dsp
new file mode 100644
index 0000000000000000000000000000000000000000..2a9f4f189ed22721b1e44e8697c2473b37a979cd
--- /dev/null
+++ b/Projects/Win32/VC6/xerces-all/IDOMTraversalTest/IDOMTraversalTest.dsp
@@ -0,0 +1,104 @@
+# Microsoft Developer Studio Project File - Name="IDOM_TraversalTest" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=IDOM_Traver sal Test - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "IDOM_TraversalTest.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "IDOM_TraversalTest.mak" CFG="IDOM_TraversalTest - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "IDOM_TraversalTest - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "IDOM_TraversalTest - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "IDOM_TraversalTest - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "..\..\..\..\..\Build\Win32\VC6\Release"
+# PROP Intermediate_Dir "..\..\..\..\..\Build\Win32\VC6\Release\obj"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /G6 /MD /Za /W3 /GX /O2 /Ob2 /I "..\..\..\..\..\src" /D "NDEBUG" /D "_CONSOLE" /D "WIN32" /D "_WINDOWS" /D "PLATFORM_WIN32" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 kernel32.lib user32.lib xerces-c_1.lib /nologo /version:1.0 /subsystem:console /machine:I386 /libpath:"..\..\..\..\..\Build\Win32\VC6\Release"
+
+!ELSEIF  "$(CFG)" == "IDOM_TraversalTest - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "..\..\..\..\..\Build\Win32\VC6\Debug"
+# PROP Intermediate_Dir "..\..\..\..\..\Build\Win32\VC6\Debug\obj"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /G6 /MDd /Za /W3 /Gm /GX /ZI /Od /I "..\..\..\..\..\src" /D "_DEBUG" /D "_CONSOLE" /D "WIN32" /D "_WINDOWS" /D "PLATFORM_WIN32" /FD /GZ /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib xerces-c_1D.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\..\..\Build\Win32\VC6\Debug"
+
+!ENDIF
+
+# Begin Target
+
+# Name "IDOM_TraversalTest - Win32 Release"
+# Name "IDOM_TraversalTest - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=..\..\..\..\..\tests\IDOM\ITraversal\ITraversal.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/Projects/Win32/VC6/xerces-all/XercesLib/XercesLib.dsp b/Projects/Win32/VC6/xerces-all/XercesLib/XercesLib.dsp
index c7a213f5d089372a29f992dd879b73479d4dc11f..42a84581a54dfef7aad41c55278df78ecfcdb084 100644
--- a/Projects/Win32/VC6/xerces-all/XercesLib/XercesLib.dsp
+++ b/Projects/Win32/VC6/xerces-all/XercesLib/XercesLib.dsp
@@ -2112,6 +2112,14 @@ SOURCE=..\..\..\..\..\src\idom\IDNodeImpl.hpp
 # End Source File
 # Begin Source File
 
+SOURCE=..\..\..\..\..\src\idom\IDNodeIteratorImpl.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\..\src\idom\IDNodeIteratorImpl.hpp
+# End Source File
+# Begin Source File
+
 SOURCE=..\..\..\..\..\src\idom\IDNodeListImpl.cpp
 # End Source File
 # Begin Source File
@@ -2284,6 +2292,14 @@ SOURCE=..\..\..\..\..\src\idom\IDTextImpl.hpp
 # End Source File
 # Begin Source File
 
+SOURCE=..\..\..\..\..\src\idom\IDTreeWalkerImpl.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\..\..\..\..\src\idom\IDTreeWalkerImpl.hpp
+# End Source File
+# Begin Source File
+
 SOURCE=..\..\..\..\..\src\idom\IDXMLDeclImpl.cpp
 # End Source File
 # Begin Source File
diff --git a/Projects/Win32/VC6/xerces-all/xerces-all.dsw b/Projects/Win32/VC6/xerces-all/xerces-all.dsw
index 3f72196e899189e61e3f6a1faa34a8e14e3fe4dc..ed8b3921af01971886c79037b59fbb04ec4f552f 100644
--- a/Projects/Win32/VC6/xerces-all/xerces-all.dsw
+++ b/Projects/Win32/VC6/xerces-all/xerces-all.dsw
@@ -165,6 +165,18 @@ Package=<4>
 
 ###############################################################################
 
+Project: "IDOM_Traver sal Test"=".\IDOMTraversalTest\IDOMTraversalTest.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
 Project: "IRangeTest"=".\IRangeTest\IRangeTest.dsp" - Package Owner=<4>
 
 Package=<5>
diff --git a/src/idom/IDDeepNodeListImpl.cpp b/src/idom/IDDeepNodeListImpl.cpp
index 123398c75fc8b0c6e44bd714707f8ea7ae0138a0..7931535b3dea58a8790adfeca3dd0926bcfc3303 100644
--- a/src/idom/IDDeepNodeListImpl.cpp
+++ b/src/idom/IDDeepNodeListImpl.cpp
@@ -56,6 +56,9 @@
 
 /*
  * $Log$
+ * Revision 1.4  2001/06/04 20:11:52  tng
+ * IDOM: Complete IDNodeIterator, IDTreeWalker, IDNodeFilter.
+ *
  * Revision 1.3  2001/06/04 14:55:32  tng
  * IDOM: Add IRange and IDeepNodeList Support.
  *
@@ -118,8 +121,6 @@ IDDeepNodeListImpl::~IDDeepNodeListImpl()
 
 IDOM_NodeList *IDDeepNodeListImpl::getDeepNodeList(const IDOM_Node *rootNode, const XMLCh *tagName)
 {
-    // idom_revisit - need to recycle NodeList objects from a free list
-    //                or allocate them from the regular heap
     if(!fNodeListPool) {
         fNodeListPool = new ((IDDocumentImpl*)rootNode->getOwnerDocument()) IDDeepNodeListPool<IDDeepNodeListImpl>(109);
     }
@@ -139,8 +140,6 @@ IDOM_NodeList *IDDeepNodeListImpl::getDeepNodeList(const IDOM_Node *rootNode,
                                                    const XMLCh *namespaceURI,
                                                    const XMLCh *localName)
 {
-    // idom_revisit - need to recycle NodeList objects from a free list
-    //                or allocate them from the regular heap
     if(!fNodeListPool) {
         fNodeListPool = new ((IDDocumentImpl*)rootNode->getOwnerDocument()) IDDeepNodeListPool<IDDeepNodeListImpl>(109);
     }
diff --git a/src/idom/IDDocumentImpl.cpp b/src/idom/IDDocumentImpl.cpp
index 873fff3c655e4944fb57d057b27ba1eeedc975e7..826f93992a344c18e694d0853ca712acbbdd10db 100644
--- a/src/idom/IDDocumentImpl.cpp
+++ b/src/idom/IDDocumentImpl.cpp
@@ -87,12 +87,12 @@
 #include "IDXMLDeclImpl.hpp"
 
 #include "IDStringPool.hpp"
-#include <internal/XMLReader.hpp>
-//#include "IDTreeWalkerImpl.hpp"
-//#include "IDNodeIteratorImpl.hpp"
+#include "IDTreeWalkerImpl.hpp"
+#include "IDNodeIteratorImpl.hpp"
 #include "IDNodeIDMap.hpp"
-#include <util/HashPtr.hpp>
 #include "IDRangeImpl.hpp"
+#include <internal/XMLReader.hpp>
+#include <util/HashPtr.hpp>
 
 
 //idom_revisit.  These can go away once all of the include files above are really there.
@@ -345,51 +345,45 @@ IDOM_NodeIterator* IDDocumentImpl::createNodeIterator (
 		//	The vector of fIterators is kept in the "owner document" if there is one. If there isn't one, I assume that root is the
 		//	owner document.
 
-#ifdef idom_revisit
-    NodeIteratorImpl* iter = new NodeIteratorImpl(root, whatToShow, filter, entityReferenceExpansion);
-    DOM_Document doc = root.getOwnerDocument();
+    IDNodeIteratorImpl* iter = new (this) IDNodeIteratorImpl(root, whatToShow, filter, entityReferenceExpansion);
+    IDOM_Document* doc = root->getOwnerDocument();
     IDDocumentImpl* impl;
 
-    if (! doc.isNull()) {
-        impl = (IDDocumentImpl *) doc.fImpl;
+    if (doc != 0) {
+        impl = (IDDocumentImpl *) doc;
     }
     else
-        impl = (IDDocumentImpl *) root.fImpl;
+        impl = (IDDocumentImpl *) root;
 
     if (impl->fIterators == 0L) {
-        impl->fIterators = new NodeIterators(1, false);
+        impl->fIterators = new (this) NodeIterators(1, false);
         impl->fIterators->addElement(iter);
     }
 
     return iter;
-#endif
-    return 0;
 }
 
 
 IDOM_TreeWalker* IDDocumentImpl::createTreeWalker (IDOM_Node *root, unsigned long whatToShow, IDOM_NodeFilter* filter, bool entityReferenceExpansion)
 {
-#ifdef idom_revisit
-		// See notes for createNodeIterator...
+    // See notes for createNodeIterator...
 
-    TreeWalkerImpl* twi = new TreeWalkerImpl(root, whatToShow, filter, entityReferenceExpansion);
-    DOM_Document doc = root.getOwnerDocument();
+    IDTreeWalkerImpl* twi = new (this) IDTreeWalkerImpl(root, whatToShow, filter, entityReferenceExpansion);
+    IDOM_Document* doc = root->getOwnerDocument();
     IDDocumentImpl* impl;
 
-    if (! doc.isNull()) {
-        impl = (IDDocumentImpl *) doc.fImpl;
+    if ( doc != 0) {
+        impl = (IDDocumentImpl *) doc;
     }
     else
-        impl = (IDDocumentImpl *) root.fImpl;
+        impl = (IDDocumentImpl *) root;
 
     if (impl->fTreeWalkers == 0L) {
-        impl->fTreeWalkers = new TreeWalkers(1, false);
+        impl->fTreeWalkers = new (this) TreeWalkers(1, false);
         impl->fTreeWalkers->addElement(twi);
     }
 
     return twi;
-#endif
-    return 0;
 }
 
 
diff --git a/src/idom/IDDocumentImpl.hpp b/src/idom/IDDocumentImpl.hpp
index b670f82562506c7a702d0f2537ec29d401723996..d589f83ac8661ab8574533dafd7372ee09ab55fe 100644
--- a/src/idom/IDDocumentImpl.hpp
+++ b/src/idom/IDDocumentImpl.hpp
@@ -126,8 +126,9 @@ public:
 
     NodeIterators               *fIterators;
     TreeWalkers                 *fTreeWalkers;
-    RefHashTableOf<void>        *fUserData;
     Ranges                      *fRanges;
+
+    RefHashTableOf<void>        *fUserData;
     int                          fChanges;
 
     bool errorChecking;                          // Bypass error checking.
@@ -202,17 +203,17 @@ public:
                                                       unsigned long whatToShow,
                                                       IDOM_NodeFilter* filter,
                                                       bool entityReferenceExpansion);
-    virtual IDOM_TreeWalker*       createTreeWalker(IDOM_Node *root,
+    virtual IDOM_TreeWalker       *createTreeWalker(IDOM_Node *root,
                                                     unsigned long whatToShow,
                                                     IDOM_NodeFilter* filter,
                                                     bool entityReferenceExpansion);
 
-    virtual IDOM_XMLDecl*          createXMLDecl(const XMLCh * version,
+    virtual IDOM_XMLDecl          *createXMLDecl(const XMLCh * version,
                                                  const XMLCh * encoding,
                                                  const XMLCh * standalone);
     virtual void*                  getUserData() const;
     virtual void                   setUserData(void* value);
-    virtual IDOM_Range*            createRange();
+    virtual IDOM_Range            *createRange();
     virtual Ranges*                getRanges() const;  //non-standard api
     virtual void                   removeRange(IDRangeImpl* range); //non-standard api
 
diff --git a/src/idom/IDNodeIteratorImpl.cpp b/src/idom/IDNodeIteratorImpl.cpp
index 75eca3ff9914bd9a4161ea68437b3a69bfb1606d..b730b961eca56bd3f3b93545dabf2adda9dfe91f 100644
--- a/src/idom/IDNodeIteratorImpl.cpp
+++ b/src/idom/IDNodeIteratorImpl.cpp
@@ -56,6 +56,9 @@
 
 /*
  * $Log$
+ * Revision 1.3  2001/06/04 20:11:52  tng
+ * IDOM: Complete IDNodeIterator, IDTreeWalker, IDNodeFilter.
+ *
  * Revision 1.2  2001/05/11 13:25:45  tng
  * Copyright update.
  *
@@ -64,41 +67,41 @@
  *
  */
 
-// NodeIteratorImpl.cpp: implementation of the NodeIteratorImpl class.
+// IDNodeIteratorImpl.cpp: implementation of the IDNodeIteratorImpl class.
 //
 //////////////////////////////////////////////////////////////////////
 
-#include "NodeIteratorImpl.hpp"
-#include "DOM_Document.hpp"
-#include "DOM_DOMException.hpp"
-#include "DocumentImpl.hpp"
+#include "IDNodeIteratorImpl.hpp"
+#include "IDOM_Document.hpp"
+#include "IDOM_DOMException.hpp"
+#include "IDDocumentImpl.hpp"
 
 //////////////////////////////////////////////////////////////////////
 // Construction/Destruction
 //////////////////////////////////////////////////////////////////////
 
-NodeIteratorImpl::NodeIteratorImpl ()
+IDNodeIteratorImpl::IDNodeIteratorImpl ()
 : fDetached(false),
     fNodeFilter(0)
 {
 }	
 
-NodeIteratorImpl::~NodeIteratorImpl ()
+IDNodeIteratorImpl::~IDNodeIteratorImpl ()
 {
 	fDetached = false;
 }
 
 
-void NodeIteratorImpl::detach ()
+void IDNodeIteratorImpl::detach ()
 {
 	fDetached = true;
 }
 
 
-NodeIteratorImpl::NodeIteratorImpl (
-                                    DOM_Node root,
+IDNodeIteratorImpl::IDNodeIteratorImpl (
+                                    IDOM_Node* root,
                                     unsigned long whatToShow,
-                                    DOM_NodeFilter* nodeFilter,
+                                    IDOM_NodeFilter* nodeFilter,
                                     bool expandEntityRef)
 :   fDetached(false),
     fRoot(root),
@@ -112,7 +115,7 @@ NodeIteratorImpl::NodeIteratorImpl (
 }
 
 
-NodeIteratorImpl::NodeIteratorImpl ( const NodeIteratorImpl& toCopy)
+IDNodeIteratorImpl::IDNodeIteratorImpl ( const IDNodeIteratorImpl& toCopy)
     :   fDetached(toCopy.fDetached),
     fRoot(toCopy.fRoot),
     fCurrentNode(toCopy.fCurrentNode),
@@ -124,13 +127,13 @@ NodeIteratorImpl::NodeIteratorImpl ( const NodeIteratorImpl& toCopy)
 }
 
 
-NodeIteratorImpl& NodeIteratorImpl::operator= (const NodeIteratorImpl& other) {
+IDNodeIteratorImpl& IDNodeIteratorImpl::operator= (const IDNodeIteratorImpl& other) {
     fRoot                   = other.fRoot;
     fCurrentNode            = other.fRoot;
     fWhatToShow             = other.fWhatToShow;
     fNodeFilter             = other.fNodeFilter;
     fForward                = other.fForward;
-	fDetached               = other.fDetached;
+    fDetached               = other.fDetached;
     fExpandEntityReferences = other.fExpandEntityReferences;
     return *this;
 }
@@ -143,45 +146,43 @@ NodeIteratorImpl& NodeIteratorImpl::operator= (const NodeIteratorImpl& other) {
 
 /** Return the whatToShow value */
 
-unsigned long NodeIteratorImpl::getWhatToShow () {
+unsigned long IDNodeIteratorImpl::getWhatToShow () {
     return fWhatToShow;
 }
 
 
 /** Return the filter */
 
-DOM_NodeFilter* NodeIteratorImpl::getFilter () {
+IDOM_NodeFilter* IDNodeIteratorImpl::getFilter () {
     return fNodeFilter;
 }
 
 /** Get the expandEntity reference flag. */
-bool NodeIteratorImpl::getExpandEntityReferences()
+bool IDNodeIteratorImpl::getExpandEntityReferences()
 {
     return fExpandEntityReferences;
 }
 
-/** Return the next DOM_Node in the Iterator. The node is the next node in
+/** Return the next IDOM_Node* in the Iterator. The node is the next node in
  *  depth-first order which also passes the filter, and whatToShow.
- *  A null return means either that
+ *  A 0 return means either that
  */
 
-DOM_Node NodeIteratorImpl::nextNode () {
+IDOM_Node* IDNodeIteratorImpl::nextNode () {
 	if (fDetached)
-		throw DOM_DOMException(DOM_DOMException::INVALID_STATE_ERR, null);
-
-	DOM_Node result;
+		throw IDOM_DOMException(IDOM_DOMException::INVALID_STATE_ERR, 0);
 
-    // if root is null there is no next node.
-    if (fRoot.isNull())
-			return result;
+    // if root is 0 there is no next node->
+    if (!fRoot)
+			return 0;
 
-    DOM_Node aNextNode = fCurrentNode;
+    IDOM_Node* aNextNode = fCurrentNode;
     bool accepted = false; // the next node has not been accepted.
 
     while (!accepted) {
 
-        // if last direction is not forward, repeat node.
-        if (!fForward && !aNextNode.isNull()) {
+        // if last direction is not forward, repeat node->
+        if (!fForward && (aNextNode != 0)) {
             //System.out.println("nextNode():!fForward:"+fCurrentNode.getNodeName());
             aNextNode = fCurrentNode;
         } else {
@@ -189,24 +190,22 @@ DOM_Node NodeIteratorImpl::nextNode () {
             aNextNode = nextNode(aNextNode, true);
         }
 
-        fForward = true; //REVIST: should direction be set forward before null check?
+        fForward = true; //REVIST: should direction be set forward before 0 check?
 
-        // nothing in the list. return null.
-        if (aNextNode.isNull())
-					return result;
+        // nothing in the list. return 0.
+        if (!aNextNode) return 0;
 
         // does node pass the filters and whatToShow?
         accepted = acceptNode(aNextNode);
         if (accepted) {
-            // if so, then the node is the current node.
+            // if so, then the node is the current node->
             fCurrentNode = aNextNode;
             return fCurrentNode;
-				}
-
+        }
     }
 
     // no nodes, or no accepted nodes.
-    return result;
+    return 0;
 }
 
 
@@ -214,24 +213,20 @@ DOM_Node NodeIteratorImpl::nextNode () {
  *  _backwards_ depth-first order which also passes the filter, and whatToShow.
  */
 
-DOM_Node NodeIteratorImpl::previousNode () {
+IDOM_Node* IDNodeIteratorImpl::previousNode () {
 	if (fDetached)
-		throw DOM_DOMException(DOM_DOMException::INVALID_STATE_ERR, null);
+		throw IDOM_DOMException(IDOM_DOMException::INVALID_STATE_ERR, 0);
 		
-	DOM_Node result;
+    // if the root is 0, or the current node is 0, return 0.
+    if (!fRoot || !fCurrentNode) return 0;
 
-    // if the root is null, or the current node is null, return null.
-    if (fRoot.isNull() || fCurrentNode.isNull())
-			return result;
-
-    DOM_Node aPreviousNode = fCurrentNode;
+    IDOM_Node* aPreviousNode = fCurrentNode;
     bool accepted = false;
 
     while (!accepted) {
 
-
-        if (fForward && ! aPreviousNode.isNull()) {
-            //repeat last node.
+        if (fForward && (aPreviousNode != 0)) {
+            //repeat last node->
             aPreviousNode = fCurrentNode;
         } else {
             // get previous node in backwards depth first order.
@@ -241,10 +236,9 @@ DOM_Node NodeIteratorImpl::previousNode () {
         // we are going backwards
         fForward = false;
 
-        // if the new previous node is null, we're at head or past the root,
-        // so return null.
-        if (aPreviousNode.isNull())
-					return result;
+        // if the new previous node is 0, we're at head or past the root,
+        // so return 0.
+        if (!aPreviousNode) return 0;
 
         // check if node passes filters and whatToShow.
         accepted = acceptNode(aPreviousNode);
@@ -255,109 +249,107 @@ DOM_Node NodeIteratorImpl::previousNode () {
         }
     }
     // there are no nodes?
-    return result;
+    return 0;
 }
 
 
 /** The node is accepted if it passes the whatToShow and the filter. */
-bool NodeIteratorImpl::acceptNode (DOM_Node node) {
+bool IDNodeIteratorImpl::acceptNode (IDOM_Node* node) {
 	if (fDetached)
-		throw DOM_DOMException(DOM_DOMException::INVALID_STATE_ERR, null);
+		throw IDOM_DOMException(IDOM_DOMException::INVALID_STATE_ERR, 0);
 
     if (fNodeFilter == 0) {
-        return ((fWhatToShow & (1 << (node.getNodeType() - 1))) != 0);
+        return ((fWhatToShow & (1 << (node->getNodeType() - 1))) != 0);
     } else {
-        return ((fWhatToShow & (1 << (node.getNodeType() - 1))) != 0)
-            && fNodeFilter->acceptNode(node) == DOM_NodeFilter::FILTER_ACCEPT;
+        return ((fWhatToShow & (1 << (node->getNodeType() - 1))) != 0)
+            && fNodeFilter->acceptNode(node) == IDOM_NodeFilter::FILTER_ACCEPT;
     }
 }
 
 
 /** Return node, if matches or any parent if matches. */
-DOM_Node NodeIteratorImpl::matchNodeOrParent (DOM_Node node) {
-		DOM_Node result;
+IDOM_Node* IDNodeIteratorImpl::matchNodeOrParent (IDOM_Node* node) {
 
-    for (DOM_Node n = node; n != fRoot; n = n.getParentNode()) {
+    for (IDOM_Node* n = node; n != fRoot; n = n->getParentNode()) {
         if (node == n) return n;
     }
 
-    return result;
+    return 0;
 }
 
 
-/** The method nextNode(DOM_Node, bool) returns the next node
+/** The method nextNode(IDOM_Node, bool) returns the next node
  *  from the actual DOM tree.
  *
  *  The bool visitChildren determines whether to visit the children.
  *  The result is the nextNode.
  */
 
-DOM_Node NodeIteratorImpl::nextNode (DOM_Node node, bool visitChildren) {
+IDOM_Node* IDNodeIteratorImpl::nextNode (IDOM_Node* node, bool visitChildren) {
 	if (fDetached)
-		throw DOM_DOMException(DOM_DOMException::INVALID_STATE_ERR, null);
+		throw IDOM_DOMException(IDOM_DOMException::INVALID_STATE_ERR, 0);
 
-    if (node.isNull()) return fRoot;
+    if (!node) return fRoot;
 
-    DOM_Node result;
+    IDOM_Node* result = 0;
     // only check children if we visit children.
     if (visitChildren) {
         //if hasChildren, return 1st child.
-        if (node.hasChildNodes()) {
-            result = node.getFirstChild();
+        if (node->hasChildNodes()) {
+            result = node->getFirstChild();
             return result;
         }
     }
 
     // if hasSibling, return sibling
     if (node != fRoot) {
-        result = node.getNextSibling();
-        if (! result.isNull()) return result;
+        result = node->getNextSibling();
+        if (result != 0) return result;
 
 
         // return parent's 1st sibling.
-        DOM_Node parent = node.getParentNode();
-        while (!parent.isNull() && parent != fRoot) {
-            result = parent.getNextSibling();
-            if (!result.isNull()) {
+        IDOM_Node* parent = node->getParentNode();
+        while ((parent != 0) && parent != fRoot) {
+            result = parent->getNextSibling();
+            if (result != 0) {
                 return result;
             } else {
-                parent = parent.getParentNode();
+                parent = parent->getParentNode();
             }
 
-        } // while (parent != null && parent != fRoot) {
+        } // while (parent != 0 && parent != fRoot) {
     }
-    // end of list, return null
-    DOM_Node aNull;
-    return aNull;
+    // end of list, return 0
+    return 0;
 }
 
 
-/** The method previousNode(DOM_Node) returns the previous node
+/** The method previousNode(IDOM_Node) returns the previous node
  *  from the actual DOM tree.
  */
 
-DOM_Node NodeIteratorImpl::previousNode (DOM_Node node) {
+IDOM_Node* IDNodeIteratorImpl::previousNode (IDOM_Node* node) {
 	if (fDetached)
-		throw DOM_DOMException(DOM_DOMException::INVALID_STATE_ERR, null);
+		throw IDOM_DOMException(IDOM_DOMException::INVALID_STATE_ERR, 0);
 
-    DOM_Node result;
+    IDOM_Node* result = 0;
 
-    // if we're at the root, return null.
+    // if we're at the root, return 0.
     if (node == fRoot)
-			return result;
+			return 0;
 
     // get sibling
-    result = node.getPreviousSibling();
-    if (result.isNull()) {
+    result = node->getPreviousSibling();
+    if (!result) {
         //if 1st sibling, return parent
-        result = node.getParentNode();
+        result = node->getParentNode();
         return result;
     }
 
     // if sibling has children, keep getting last child of child.
-    if (result.hasChildNodes()) {
-        while (result.hasChildNodes()) {
-            result = result.getLastChild();
+    if (result->hasChildNodes()) {
+        while (result->hasChildNodes()) {
+            result = result->getLastChild();
         }
     }
 
@@ -369,27 +361,26 @@ DOM_Node NodeIteratorImpl::previousNode (DOM_Node node) {
  *  before an actual DOM remove.
  */
 
-void NodeIteratorImpl::removeNode (DOM_Node node) {
+void IDNodeIteratorImpl::removeNode (IDOM_Node* node) {
 	if (fDetached)
-		throw DOM_DOMException(DOM_DOMException::INVALID_STATE_ERR, null);
+		throw IDOM_DOMException(IDOM_DOMException::INVALID_STATE_ERR, 0);
 
     // Implementation note: Fix-up means setting the current node properly
     // after a remove.
 
-    if (node.isNull())
-				return;
+    if (!node) return;
 
-    DOM_Node deleted = matchNodeOrParent(node);
+    IDOM_Node* deleted = matchNodeOrParent(node);
 
-    if (deleted.isNull()) return;
+    if (!deleted) return;
 
     if (fForward) {
         fCurrentNode = previousNode(deleted);
     } else
     // if (!fForward)
     {
-        DOM_Node next = nextNode(deleted, false);
-        if (! next.isNull()) {
+        IDOM_Node* next = nextNode(deleted, false);
+        if (next != 0) {
             // normal case: there _are_ nodes following this in the iterator.
             fCurrentNode = next;
         } else {
@@ -403,27 +394,3 @@ void NodeIteratorImpl::removeNode (DOM_Node node) {
 
 }
 
-
-void NodeIteratorImpl::unreferenced()
-{
-    DOM_Document doc = fRoot.getOwnerDocument();
-    DocumentImpl* impl;
-
-    if (! doc.isNull()) {
-        impl = (DocumentImpl *) doc.fImpl;
-    }
-    else
-        impl = (DocumentImpl *) fRoot.fImpl;
-
-    if (impl->iterators != 0L) {
-        int i;
-        int sz = impl->iterators->size();
-        for (i = 0; i < sz; i++)
-            if (impl->iterators->elementAt(i) == this) {
-                impl->iterators->removeElementAt(i);
-                break;
-            }
-    }
-
-    delete this;
-}
diff --git a/src/idom/IDNodeIteratorImpl.hpp b/src/idom/IDNodeIteratorImpl.hpp
index 241ea360a29f15dc3ba2381bf7df364d1df3d67b..eb46eb12ed276d1e6c8a34d28516d5c9b76344b0 100644
--- a/src/idom/IDNodeIteratorImpl.hpp
+++ b/src/idom/IDNodeIteratorImpl.hpp
@@ -56,6 +56,9 @@
 
 /*
  * $Log$
+ * Revision 1.3  2001/06/04 20:11:52  tng
+ * IDOM: Complete IDNodeIterator, IDTreeWalker, IDNodeFilter.
+ *
  * Revision 1.2  2001/05/11 13:25:45  tng
  * Copyright update.
  *
@@ -64,93 +67,87 @@
  *
  */
 
-#ifndef NodeIteratorImpl_HEADER_GUARD_
-#define NodeIteratorImpl_HEADER_GUARD_
+#ifndef IDNodeIteratorImpl_HEADER_GUARD_
+#define IDNodeIteratorImpl_HEADER_GUARD_
 
 
-// NodeIteratorImpl.hpp: interface for the NodeIteratorImpl class.
+// IDNodeIteratorImpl.hpp: interface for the IDNodeIteratorImpl class.
 //
 //////////////////////////////////////////////////////////////////////
 
-#include "DOM_Node.hpp"
-#include "DOM_NodeIterator.hpp"
-#include "RefCountedImpl.hpp"
-
-
-class CDOM_EXPORT NodeIteratorImpl : public RefCountedImpl {
-	protected:
-		NodeIteratorImpl ();
-
-	public:
-		virtual ~NodeIteratorImpl ();
-		NodeIteratorImpl (
-            DOM_Node root,
-            unsigned long whatToShow,
-            DOM_NodeFilter* nodeFilter,
-            bool expandEntityRef);
+#include "IDOM_Node.hpp"
+#include "IDOM_NodeIterator.hpp"
 
-        NodeIteratorImpl ( const NodeIteratorImpl& toCopy);
-		
-        NodeIteratorImpl& operator= (const NodeIteratorImpl& other);
-		
-        unsigned long getWhatToShow ();
-		DOM_NodeFilter* getFilter ();
 
-		DOM_Node nextNode ();
-		DOM_Node previousNode ();
-		bool acceptNode (DOM_Node node);
-		DOM_Node matchNodeOrParent (DOM_Node node);
-		DOM_Node nextNode (DOM_Node node, bool visitChildren);
-		DOM_Node previousNode (DOM_Node node);
-		void removeNode (DOM_Node node);
+class CDOM_EXPORT IDNodeIteratorImpl : public IDOM_NodeIterator {
+    private:
+        //
+        // Data
+        //
+        // The root.
+        IDOM_Node* fRoot;
 
-		void unreferenced();
+        // The whatToShow mask.
+        unsigned long fWhatToShow;
 
-		void detach ();
-
-        // Get the expandEntity reference flag.
-        bool getExpandEntityReferences();
+        // The NodeFilter reference.
+        IDOM_NodeFilter* fNodeFilter;
 
 
-	private:
-		//
-		// Data
-		//
-		// The root.
-		DOM_Node fRoot;
-
-		// The whatToShow mask.
-		unsigned long fWhatToShow;
-
-		// The NodeFilter reference.
-		DOM_NodeFilter* fNodeFilter;
-
         // The expandEntity reference flag.
         bool  fExpandEntityReferences;
+        bool fDetached;
+
+
+        //
+        // Iterator state - current node and direction.
+        //
+        // Note: The current node and direction are sufficient to implement
+        // the desired behaviour of the current pointer being _between_
+        // two nodes. The fCurrentNode is actually the last node returned,
+        // and the
+        // direction is whether the pointer is in front or behind this node.
+        // (usually akin to whether the node was returned via nextNode())
+        // (eg fForward = true) or previousNode() (eg fForward = false).
+        // The last Node returned.
+        IDOM_Node* fCurrentNode;
+
+        // The direction of the iterator on the fCurrentNode.
+        //  <pre>
+        //  nextNode()  ==      fForward = true;
+        //  previousNode() ==   fForward = false;
+        //  </pre>
+        bool fForward;
+
+    protected:
+        IDNodeIteratorImpl ();
+
+    public:
+        virtual ~IDNodeIteratorImpl ();
+        IDNodeIteratorImpl (
+            IDOM_Node* root,
+            unsigned long whatToShow,
+            IDOM_NodeFilter* nodeFilter,
+            bool expandEntityRef);
 
-		bool fDetached;
-
-		//
-		// Iterator state - current node and direction.
-		//
-		// Note: The current node and direction are sufficient to implement
-		// the desired behaviour of the current pointer being _between_
-		// two nodes. The fCurrentNode is actually the last node returned,
-		// and the
-		// direction is whether the pointer is in front or behind this node.
-		// (usually akin to whether the node was returned via nextNode())
-		// (eg fForward = true) or previousNode() (eg fForward = false).
-
-		// The last Node returned.
-		DOM_Node fCurrentNode;
-
-		// The direction of the iterator on the fCurrentNode.
-		//  <pre>
-		//  nextNode()  ==      fForward = true;
-		//  previousNode() ==   fForward = false;
-		//  </pre>
-		bool fForward;
-
+        IDNodeIteratorImpl ( const IDNodeIteratorImpl& toCopy);
+        IDNodeIteratorImpl& operator= (const IDNodeIteratorImpl& other);
+        	
+        virtual unsigned long getWhatToShow ();
+        virtual IDOM_NodeFilter* getFilter ();
+        // Get the expandEntity reference flag.
+        virtual bool getExpandEntityReferences();
+
+        virtual IDOM_Node* nextNode ();
+        virtual IDOM_Node* previousNode ();
+        virtual void detach ();
+
+    private:
+        IDOM_Node* matchNodeOrParent (IDOM_Node* node);
+        IDOM_Node* nextNode (IDOM_Node* node, bool visitChildren);
+        IDOM_Node* previousNode (IDOM_Node* node);
+        void removeNode (IDOM_Node* node);
+        bool acceptNode (IDOM_Node* node);
 
 };
 
diff --git a/src/idom/IDOM.hpp b/src/idom/IDOM.hpp
index 20d7cf5c0d2439282ac1b48bcb09952a1021116f..8a2e615f7c87493a95e7377921d3e92a1a24acf1 100644
--- a/src/idom/IDOM.hpp
+++ b/src/idom/IDOM.hpp
@@ -1,5 +1,5 @@
-#ifndef DOM_HEADER_GUARD_
-#define DOM_HEADER_GUARD_
+#ifndef IDOM_HEADER_GUARD_HPP
+#define IDOM_HEADER_GUARD_HPP
 
 
 /*
@@ -60,6 +60,9 @@
 
 /*
  * $Log$
+ * Revision 1.3  2001/06/04 20:11:53  tng
+ * IDOM: Complete IDNodeIterator, IDTreeWalker, IDNodeFilter.
+ *
  * Revision 1.2  2001/05/11 13:25:48  tng
  * Copyright update.
  *
@@ -87,11 +90,15 @@
 #include <idom/IDOM_EntityReference.hpp>
 #include <idom/IDOM_NamedNodeMap.hpp>
 #include <idom/IDOM_Node.hpp>
+#include <idom/IDOM_NodeFilter.hpp>
+#include <idom/IDOM_NodeIterator.hpp>
 #include <idom/IDOM_NodeList.hpp>
 #include <idom/IDOM_Notation.hpp>
 #include <idom/IDOM_ProcessingInstruction.hpp>
+#include <idom/IDOM_Range.hpp>
+#include <idom/IDOM_RangeException.hpp>
 #include <idom/IDOM_Text.hpp>
+#include <idom/IDOM_TreeWalker.hpp>
 #include <idom/IDOM_XMLDecl.hpp>
 
-
 #endif
diff --git a/src/idom/IDOM_NodeFilter.hpp b/src/idom/IDOM_NodeFilter.hpp
index 69cc5986c57381a996b26b4eda53e0933edb499e..5be5f946dd8aabb80751631d35e4aa833e2ef8bc 100644
--- a/src/idom/IDOM_NodeFilter.hpp
+++ b/src/idom/IDOM_NodeFilter.hpp
@@ -56,6 +56,9 @@
 
 /*
  * $Log$
+ * Revision 1.3  2001/06/04 20:11:53  tng
+ * IDOM: Complete IDNodeIterator, IDTreeWalker, IDNodeFilter.
+ *
  * Revision 1.2  2001/05/11 13:25:53  tng
  * Copyright update.
  *
@@ -64,21 +67,21 @@
  *
  */
 
-// DOM_NodeFilter.h: interface for the DOM_NodeFilter class.
+// IDOM_NodeFilter.h: interface for the IDOM_NodeFilter class.
 //
 //////////////////////////////////////////////////////////////////////
 
-#ifndef DOM_NodeFilter_HEADER_GUARD_
-#define DOM_NodeFilter_HEADER_GUARD_
+#ifndef IDOM_NodeFilter_HEADER_GUARD_
+#define IDOM_NodeFilter_HEADER_GUARD_
 
-#include "DOM_Node.hpp"
+#include "IDOM_Node.hpp"
 
-class NodeFilterImpl;
+class IDNodeFilterImpl;
 
 
 /**
  * Filters are objects that know how to "filter out" nodes. If a
- * <code>DOM_NodeIterator</code> or <code>DOM_TreeWalker</code> is given a
+ * <code>IDOM_NodeIterator</code> or <code>IDOM_TreeWalker</code> is given a
  * filter, it applies the filter before it returns the next node.
  *
  * If the filter says to accept the node, the iterator returns it; otherwise, the
@@ -97,33 +100,38 @@ class NodeFilterImpl;
  * <p><b>"Experimental - subject to change"</b></p>
  *
  */
-class CDOM_EXPORT DOM_NodeFilter
+class CDOM_EXPORT IDOM_NodeFilter
 {
+    protected:
+        IDOM_NodeFilter() {};
+        IDOM_NodeFilter(const IDOM_NodeFilter &other) {};
+        IDOM_NodeFilter & operator = (const IDOM_NodeFilter &other) {return *this;};
+
     public:
-	/** @name Enumerators for Node Filter */
+        /** @name Enumerators for Node Filter */
         //@{
-	/*
-	  *		<table><tr><td>FILTER_ACCEPT</td>
-      *            <td>Accept the node. Navigation methods defined for
-      *                NodeIterator or TreeWalker will return this node.</td>
-	  *			</tr>
-	  *			<tr><td>
-      *               FILTER_REJECT</td>
-      *               <td>Reject the node. Navigation methods defined for
-      *               NodeIterator or TreeWalker will not return this
-      *               node. For TreeWalker, the children of this node will
-      *               also be rejected. Iterators treat this as a synonym
-      *               for FILTER_SKIP.</td>
-	  *			</tr>
-	  *			<tr><td>FILTER_SKIP</td>
-      *              <td>Reject the node. Navigation methods defined for
-      *                  NodeIterator or TreeWalker will not return this
-      *                  node. For both NodeIterator and Treewalker, the
-      *                  children of this node will still be considered.</td>
- 	  *			</tr>
-	  *		</table>
-      *
-	  */
+        /*
+         *    <table><tr><td>FILTER_ACCEPT</td>
+         *               <td>Accept the node. Navigation methods defined for
+         *               NodeIterator or TreeWalker will return this node.</td>
+         *           </tr>
+         *           <tr>
+         *               <td>FILTER_REJECT</td>
+         *               <td>Reject the node. Navigation methods defined for
+         *               NodeIterator or TreeWalker will not return this
+         *               node. For TreeWalker, the children of this node will
+         *               also be rejected. Iterators treat this as a synonym
+         *               for FILTER_SKIP.</td>
+         *           </tr>
+         *           <tr><td>FILTER_SKIP</td>
+         *               <td>Reject the node. Navigation methods defined for
+         *               NodeIterator or TreeWalker will not return this
+         *               node. For both NodeIterator and Treewalker, the
+         *               children of this node will still be considered.</td>
+         *           </tr>
+         *    </table>
+         *
+         */
         enum FilterAction {FILTER_ACCEPT = 1,
                            FILTER_REJECT = 2,
                            FILTER_SKIP   = 3};
@@ -143,45 +151,24 @@ class CDOM_EXPORT DOM_NodeFilter
             SHOW_DOCUMENT_FRAGMENT         = 0x00000400,
             SHOW_NOTATION                  = 0x00000800
         };
-	//@}
-
-        /** @name Constructors */
-        //@{
-        /**
-          * Default constructor for DOM_NodeFilter.
-          */
-        DOM_NodeFilter();
-        //@}
-
-        /** @name Destructor. */
-        //@{
-	/**
-	  * Destructor for DOM_NodeFilter.
-	  */
-        virtual ~DOM_NodeFilter();
         //@}
 
         /** @name Test function. */
         //@{
-	/**
-	  * Test whether a specified node is visible in the logical view of a DOM_TreeWalker
-	  * or DOM_NodeIterator. This function will be called by the implementation of
-	  * DOM_TreeWalker and DOM_NodeIterator; it is not intended to be called directly from user
-	  * code.
-          *
-          * <p><b>"Experimental - subject to change"</b></p>
-          *
-          * @param node The node to check to see if it passes the filter or not.
-          * @return A constant to determine whether the node is accepted, rejected, or skipped.
-	  */
-        virtual short acceptNode (const DOM_Node &node) const =0;
+        /**
+         * Test whether a specified node is visible in the logical view of a IDOM_TreeWalker
+         * or IDOM_NodeIterator. This function will be called by the implementation of
+         * IDOM_TreeWalker and IDOM_NodeIterator; it is not intended to be called directly from user
+         * code.
+         *
+         * <p><b>"Experimental - subject to change"</b></p>
+         *
+         * @param node The node to check to see if it passes the filter or not.
+         * @return A constant to determine whether the node is accepted, rejected, or skipped.
+         */
+        virtual short acceptNode (const IDOM_Node* node) const =0;
         //@}
 
-    private:
-        DOM_NodeFilter(const DOM_NodeFilter &other);
-        DOM_NodeFilter & operator = (const DOM_NodeFilter &other);
-        bool operator == (const DOM_NodeFilter &other) const;
-        bool operator != (const DOM_NodeFilter &other) const;
 };
 
 #endif
diff --git a/src/idom/IDOM_NodeIterator.hpp b/src/idom/IDOM_NodeIterator.hpp
index 8a49f248b2aaeb3ed64bbc48b715802b2c167b38..7304ecc9ff9be46a05900bb0b15bde8540941829 100644
--- a/src/idom/IDOM_NodeIterator.hpp
+++ b/src/idom/IDOM_NodeIterator.hpp
@@ -56,6 +56,9 @@
 
 /*
  * $Log$
+ * Revision 1.3  2001/06/04 20:11:53  tng
+ * IDOM: Complete IDNodeIterator, IDTreeWalker, IDNodeFilter.
+ *
  * Revision 1.2  2001/05/11 13:25:53  tng
  * Copyright update.
  *
@@ -64,13 +67,13 @@
  *
  */
 
-#ifndef DOM_NodeIterator_HEADER_GUARD_
-#define DOM_NodeIterator_HEADER_GUARD_
+#ifndef IDOM_NodeIterator_HEADER_GUARD_
+#define IDOM_NodeIterator_HEADER_GUARD_
 
-#include "DOM_NodeFilter.hpp"
-#include "DOM_Node.hpp"
+#include "IDOM_NodeFilter.hpp"
+#include "IDOM_Node.hpp"
 
-class NodeIteratorImpl;
+class IDNodeIteratorImpl;
 
 /**
  * NodeIterators are used to step through a set of nodes
@@ -85,87 +88,24 @@ class NodeIteratorImpl;
  * <p><b>"Experimental - subject to change"</b></p>
  *
  */
-class CDOM_EXPORT DOM_NodeIterator
+class CDOM_EXPORT IDOM_NodeIterator
 {
-    public:
-        /** @name Constructors and assignment operator */
-        //@{
-        /**
-          * Default constructor.
-          */
-        DOM_NodeIterator ();
-
-        /**
-          * Copy constructor.
-          *
-          * @param other The object to be copied.
-          */
-        DOM_NodeIterator(const DOM_NodeIterator &other);
-
-        /**
-          * Assignment operator.
-          *
-          * @param other The object to be copied.
-          */
-        DOM_NodeIterator & operator = (const DOM_NodeIterator &other);
-
-        /**
-          * Assignment operator.  This overloaded variant is provided for
-          *   the sole purpose of setting a DOM_NodeIterator to null.
-          *
-          * @param val.  Only a value of 0, or null, is allowed.
-          */
-        DOM_NodeIterator & operator = (const DOM_NullPtr *val);
-        //@}
-
-        /** @name Destructor. */
-        //@{
-	/**
-	  * Destructor for DOM_NodeIterator.
-	  */
-        ~DOM_NodeIterator();
-        //@}
-
-        /** @name Equality and Inequality operators. */
-        //@{
-        /**
-         * The equality operator.
-         *
-         * @param other The object reference with which <code>this</code> object is compared
-         * @returns True if both <code>DOM_NodeIterator</code>s refer to the same
-         *  actual node, or are both null; return false otherwise.
-         */
-        bool operator == (const DOM_NodeIterator & other)const;
-
-        /**
-          *  Compare with a pointer.  Intended only to allow a convenient
-          *    comparison with null.
-          */
-        bool operator == (const DOM_NullPtr *other) const;
-
-        /**
-         * The inequality operator.  See operator ==.
-         */
-        bool operator != (const DOM_NodeIterator & other) const;
-
-         /**
-          *  Compare with a pointer.  Intended only to allow a convenient
-          *    comparison with null.
-          *
-          */
-        bool operator != (const DOM_NullPtr * other) const;
-        //@}
+    protected:
+        IDOM_NodeIterator() {};
+        IDOM_NodeIterator(const IDOM_NodeIterator &other) {};
+        IDOM_NodeIterator & operator = (const IDOM_NodeIterator &other) {return *this;};
 
+    public:
         /** @name Get functions. */
         //@{
         /**
           * Return which node types are presented via the iterator.
-          * The available set of constants is defined in the DOM_NodeFilter interface.
+          * The available set of constants is defined in the IDOM_NodeFilter interface.
           *
           * <p><b>"Experimental - subject to change"</b></p>
           *
           */
-        unsigned long       getWhatToShow();
+        virtual unsigned long       getWhatToShow() = 0;
 
         /**
           * Return The filter used to screen nodes.
@@ -173,21 +113,21 @@ class CDOM_EXPORT DOM_NodeIterator
           * <p><b>"Experimental - subject to change"</b></p>
           *
           */
-        DOM_NodeFilter*     getFilter();
+        virtual IDOM_NodeFilter*     getFilter() = 0;
 
         /**
           * Return the expandEntityReferences flag.
           * The value of this flag determines whether the children of entity reference
-          * nodes are visible to the DOM_NodeFilter. If false, they will be skipped over.
+          * nodes are visible to the IDOM_NodeFilter. If false, they will be skipped over.
           *
           * <p><b>"Experimental - subject to change"</b></p>
           *
           */
-        bool getExpandEntityReferences();
+        virtual bool getExpandEntityReferences() = 0;
 
         /**
           * Returns the next node in the set and advances the position of the iterator
-          * in the set. After a DOM_NodeIterator is created, the first call to nextNode()
+          * in the set. After a IDOM_NodeIterator is created, the first call to nextNode()
           * returns the first node in the set.
           *
           * <p><b>"Experimental - subject to change"</b></p>
@@ -196,7 +136,7 @@ class CDOM_EXPORT DOM_NodeIterator
           *   INVALID_STATE_ERR: Raised if this method is called after the
           *   <code>detach</code> method was invoked.
           */
-        DOM_Node            nextNode();
+        virtual IDOM_Node*           nextNode() = 0;
 
         /**
           * Returns the previous node in the set and moves the position of the iterator
@@ -208,7 +148,7 @@ class CDOM_EXPORT DOM_NodeIterator
           *   INVALID_STATE_ERR: Raised if this method is called after the
           *   <code>detach</code> method was invoked.
           */
-        DOM_Node            previousNode();
+        virtual IDOM_Node*           previousNode() = 0;
         //@}
 
         /** @name Detaching functions. */
@@ -222,16 +162,8 @@ class CDOM_EXPORT DOM_NodeIterator
           * <p><b>"Experimental - subject to change"</b></p>
           *
           */
-	void				detach();
+        virtual void                 detach() = 0;
         //@}
-
-    protected:
-        DOM_NodeIterator (NodeIteratorImpl* impl);
-
-        friend class DOM_Document;
-
-    private:
-        NodeIteratorImpl*                 fImpl;
 };
 
 #endif
diff --git a/src/idom/IDOM_TreeWalker.hpp b/src/idom/IDOM_TreeWalker.hpp
index 9a3be20d75a3569bc937cde8682ee8209d6b1972..6d9ea614dfe276432813da9e944b335b89b80d74 100644
--- a/src/idom/IDOM_TreeWalker.hpp
+++ b/src/idom/IDOM_TreeWalker.hpp
@@ -56,6 +56,9 @@
 
 /*
  * $Log$
+ * Revision 1.3  2001/06/04 20:11:53  tng
+ * IDOM: Complete IDNodeIterator, IDTreeWalker, IDNodeFilter.
+ *
  * Revision 1.2  2001/05/11 13:25:56  tng
  * Copyright update.
  *
@@ -64,25 +67,23 @@
  *
  */
 
-#ifndef DOM_TreeWalker_HEADER_GUARD_
-#define DOM_TreeWalker_HEADER_GUARD_
-
-#include "DOM_Node.hpp"
-#include "DOM_NodeFilter.hpp"
+#ifndef IDOM_TreeWalker_HEADER_GUARD_
+#define IDOM_TreeWalker_HEADER_GUARD_
 
-class TreeWalkerImpl;
+#include "IDOM_Node.hpp"
+#include "IDOM_NodeFilter.hpp"
 
 
 /**
- * <code>DOM_TreeWalker</code> objects are used to navigate a document tree or
+ * <code>IDOM_TreeWalker</code> objects are used to navigate a document tree or
  * subtree using the view of the document defined by its <code>whatToShow</code>
- * flags and any filters that are defined for the <code>DOM_TreeWalker</code>. Any
- * function which performs navigation using a <code>DOM_TreeWalker</code> will
- * automatically support any view defined by a <code>DOM_TreeWalker</code>.
+ * flags and any filters that are defined for the <code>IDOM_TreeWalker</code>. Any
+ * function which performs navigation using a <code>IDOM_TreeWalker</code> will
+ * automatically support any view defined by a <code>IDOM_TreeWalker</code>.
  *
  * Omitting nodes from the logical view of a subtree can result in a structure that is
  * substantially different from the same subtree in the complete, unfiltered document. Nodes
- * that are siblings in the DOM_TreeWalker view may be children of different, widely separated
+ * that are siblings in the IDOM_TreeWalker view may be children of different, widely separated
  * nodes in the original view. For instance, consider a Filter that skips all nodes except for
  * Text nodes and the root node of a document. In the logical view that results, all text
  * nodes will be siblings and appear as direct children of the root node, no matter how
@@ -91,86 +92,23 @@ class TreeWalkerImpl;
  * <p><b>"Experimental - subject to change"</b></p>
  *
  */
-class CDOM_EXPORT DOM_TreeWalker {
-    public:
-        /** @name Constructors and assignment operator */
-        //@{
-        /**
-          * Default constructor.
-          */
-        DOM_TreeWalker();
-
-        /**
-          * Copy constructor.
-          *
-          * @param other The object to be copied.
-          */
-        DOM_TreeWalker(const DOM_TreeWalker &other);
-
-        /**
-          * Assignment operator.
-          *
-          * @param other The object to be copied.
-          */
-        DOM_TreeWalker & operator = (const DOM_TreeWalker &other);
-
-        /**
-          * Assignment operator.  This overloaded variant is provided for
-          *   the sole purpose of setting a DOM_NodeIterator to null.
-          *
-          * @param val.  Only a value of 0, or null, is allowed.
-          */
-        DOM_TreeWalker & operator = (const DOM_NullPtr *val);
-        //@}
-
-        /** @name Destructor. */
-        //@{
-	/**
-	  * Destructor for DOM_TreeWalker.
-	  */
-        ~DOM_TreeWalker();
-        //@}
-
-        /** @name Equality and Inequality operators. */
-        //@{
-        /**
-         * The equality operator.
-         *
-         * @param other The object reference with which <code>this</code> object is compared
-         * @returns True if both <code>DOM_TreeWalker</code>s refer to the same
-         *  actual node, or are both null; return false otherwise.
-         */
-        bool operator == (const DOM_TreeWalker & other)const;
-
-        /**
-          *  Compare with a pointer.  Intended only to allow a convenient
-          *    comparison with null.
-          */
-        bool operator == (const DOM_NullPtr *other) const;
-
-        /**
-         * The inequality operator.  See operator ==.
-         */
-        bool operator != (const DOM_TreeWalker & other) const;
-
-         /**
-          *  Compare with a pointer.  Intended only to allow a convenient
-          *    comparison with null.
-          *
-          */
-        bool operator != (const DOM_NullPtr * other) const;
-        //@}
+class CDOM_EXPORT IDOM_TreeWalker {
+    protected:
+        IDOM_TreeWalker() {};
+        IDOM_TreeWalker(const IDOM_TreeWalker &other) {};
+        IDOM_TreeWalker & operator = (const IDOM_TreeWalker &other) {return *this;};
 
+    public:
         /** @name Get functions. */
         //@{
         /**
-          * Return which node types are presented via the DOM_TreeWalker.
-          * These constants are defined in the DOM_NodeFilter interface.
+          * Return which node types are presented via the IDOM_TreeWalker.
+          * These constants are defined in the IDOM_NodeFilter interface.
           *
           * <p><b>"Experimental - subject to change"</b></p>
           *
           */
-        unsigned long   	getWhatToShow();
+        virtual unsigned long   	getWhatToShow()= 0;
 
         /**
           * Return The filter used to screen nodes.
@@ -178,121 +116,112 @@ class CDOM_EXPORT DOM_TreeWalker {
           * <p><b>"Experimental - subject to change"</b></p>
           *
           */
-        DOM_NodeFilter*		getFilter();
+        virtual IDOM_NodeFilter*		getFilter()= 0;
 
         /**
           * Return the expandEntityReferences flag.
           * The value of this flag determines whether the children of entity reference
-          * nodes are visible to the DOM_TreeWalker. If false, they will be skipped over.
+          * nodes are visible to the IDOM_TreeWalker. If false, they will be skipped over.
           *
           * <p><b>"Experimental - subject to change"</b></p>
           *
           */
-        bool getExpandEntityReferences();
+        virtual bool getExpandEntityReferences()= 0;
 
         /**
-          * Return the node at which the DOM_TreeWalker is currently positioned.
+          * Return the node at which the IDOM_TreeWalker is currently positioned.
           *
           * <p><b>"Experimental - subject to change"</b></p>
           *
           */
-        DOM_Node		getCurrentNode();
+        virtual IDOM_Node*		getCurrentNode()= 0;
 
         /**
           * Moves to and returns the closest visible ancestor node of the current node.
-          * If the search for parentNode attempts to step upward from the DOM_TreeWalker's root
+          * If the search for parentNode attempts to step upward from the IDOM_TreeWalker's root
           * node, or if it fails to find a visible ancestor node, this method retains the
           * current position and returns null.
           *
           * <p><b>"Experimental - subject to change"</b></p>
           *
           */
-        DOM_Node		parentNode();
+        virtual IDOM_Node*		parentNode()= 0;
 
         /**
-          * Moves the <code>DOM_TreeWalker</code> to the first child of the current node,
+          * Moves the <code>IDOM_TreeWalker</code> to the first child of the current node,
           * and returns the new node. If the current node has no children, returns
           * <code>null</code>, and retains the current node.
           *
           * <p><b>"Experimental - subject to change"</b></p>
           *
           */
-        DOM_Node		firstChild();
+        virtual IDOM_Node*		firstChild()= 0;
 
         /**
-          * Moves the <code>DOM_TreeWalker</code> to the last child of the current node, and
+          * Moves the <code>IDOM_TreeWalker</code> to the last child of the current node, and
           * returns the new node. If the current node has no children, returns
           * <code>null</code>, and retains the current node.
           *
           * <p><b>"Experimental - subject to change"</b></p>
           *
           */
-        DOM_Node		lastChild();
+        virtual IDOM_Node*		lastChild()= 0;
 
         /**
-          * Moves the <code>DOM_TreeWalker</code> to the previous sibling of the current
+          * Moves the <code>IDOM_TreeWalker</code> to the previous sibling of the current
           * node, and returns the new node. If the current node has no previous sibling,
           * returns <code>null</code>, and retains the current node.
           *
           * <p><b>"Experimental - subject to change"</b></p>
           *
           */
-        DOM_Node		previousSibling();
+        virtual IDOM_Node*		previousSibling()= 0;
 
         /**
-          * Moves the <code>DOM_TreeWalker</code> to the next sibling of the current node,
+          * Moves the <code>IDOM_TreeWalker</code> to the next sibling of the current node,
           * and returns the new node. If the current node has no next sibling, returns
           * <code>null</code>, and retains the current node.
           *
           * <p><b>"Experimental - subject to change"</b></p>
           *
           */
-        DOM_Node		nextSibling();
+        virtual IDOM_Node*		nextSibling()= 0;
 
         /**
-          * Moves the <code>DOM_TreeWalker</code> to the previous visible node in document
+          * Moves the <code>IDOM_TreeWalker</code> to the previous visible node in document
           * order relative to the current node, and returns the new node. If the current
           * node has no previous node,
-          * or if the search for previousNode attempts to step upward from the DOM_TreeWalker's
+          * or if the search for previousNode attempts to step upward from the IDOM_TreeWalker's
           * root node, returns <code>null</code>, and retains the current node.
           *
           * <p><b>"Experimental - subject to change"</b></p>
           *
           */
-        DOM_Node		previousNode();
+        virtual IDOM_Node*		previousNode()= 0;
 
         /**
-          * Moves the <code>DOM_TreeWalker</code> to the next visible node in document order
+          * Moves the <code>IDOM_TreeWalker</code> to the next visible node in document order
           * relative to the current node, and returns the new node. If the current node has
           * no next node,
-          * or if the search for nextNode attempts to step upward from the DOM_TreeWalker's
+          * or if the search for nextNode attempts to step upward from the IDOM_TreeWalker's
           * root node, returns <code>null</code>, and retains the current node.
           *
           * <p><b>"Experimental - subject to change"</b></p>
           *
           */
-        DOM_Node		nextNode();
+        virtual IDOM_Node*		nextNode()= 0;
         //@}
 
         /** @name Set functions. */
         //@{
         /**
-          * Set the node at which the DOM_TreeWalker is currently positioned.
+          * Set the node at which the IDOM_TreeWalker is currently positioned.
           *
           * <p><b>"Experimental - subject to change"</b></p>
           *
           */
-        void			setCurrentNode(DOM_Node currentNode);
+        virtual void			setCurrentNode(IDOM_Node* currentNode)= 0;
         //@}
-
-
-    protected:
-        DOM_TreeWalker(TreeWalkerImpl* impl);
-
-        friend class DOM_Document;
-
-    private:
-        TreeWalkerImpl*         fImpl;
 };
 
 #endif
diff --git a/src/idom/IDTreeWalkerImpl.cpp b/src/idom/IDTreeWalkerImpl.cpp
index d1ff3c6ceabe5015d637262093247e8f5acb9e72..1a5468a113a846825259fb17df16d794ad1a3df3 100644
--- a/src/idom/IDTreeWalkerImpl.cpp
+++ b/src/idom/IDTreeWalkerImpl.cpp
@@ -56,6 +56,9 @@
 
 /*
  * $Log$
+ * Revision 1.3  2001/06/04 20:11:53  tng
+ * IDOM: Complete IDNodeIterator, IDTreeWalker, IDNodeFilter.
+ *
  * Revision 1.2  2001/05/11 13:26:00  tng
  * Copyright update.
  *
@@ -64,17 +67,17 @@
  *
  */
 
-#include "TreeWalkerImpl.hpp"
-#include "DOM_Document.hpp"
-#include "DOM_DOMException.hpp"
-#include "DocumentImpl.hpp"
+#include "IDTreeWalkerImpl.hpp"
+#include "IDOM_Document.hpp"
+#include "IDOM_DOMException.hpp"
+#include "IDDocumentImpl.hpp"
 
 
 /** constructor */
-TreeWalkerImpl::TreeWalkerImpl (
-                                DOM_Node root,
+IDTreeWalkerImpl::IDTreeWalkerImpl (
+                                IDOM_Node* root,
                                 unsigned long whatToShow,
-                                DOM_NodeFilter* nodeFilter,
+                                IDOM_NodeFilter* nodeFilter,
                                 bool expandEntityRef)
 :   fCurrentNode(root),
     fRoot(root),
@@ -86,7 +89,7 @@ TreeWalkerImpl::TreeWalkerImpl (
 }
 
 
-TreeWalkerImpl::TreeWalkerImpl (const TreeWalkerImpl& twi)
+IDTreeWalkerImpl::IDTreeWalkerImpl (const IDTreeWalkerImpl& twi)
 : fCurrentNode(twi.fCurrentNode),
     fRoot(twi.fRoot),
     fWhatToShow(twi.fWhatToShow),
@@ -96,7 +99,7 @@ TreeWalkerImpl::TreeWalkerImpl (const TreeWalkerImpl& twi)
 }
 
 
-TreeWalkerImpl& TreeWalkerImpl::operator= (const TreeWalkerImpl& twi) {
+IDTreeWalkerImpl& IDTreeWalkerImpl::operator= (const IDTreeWalkerImpl& twi) {
     if (this != &twi)
     {
         fCurrentNode            = twi.fCurrentNode;
@@ -111,58 +114,33 @@ TreeWalkerImpl& TreeWalkerImpl::operator= (const TreeWalkerImpl& twi) {
 
 
 
-void TreeWalkerImpl::unreferenced()
-{
-    DOM_Document doc = fRoot.getOwnerDocument();
-    DocumentImpl* impl;
-
-    if (! doc.isNull()) {
-        impl = (DocumentImpl *) doc.fImpl;
-    }
-    else
-        impl = (DocumentImpl *) fRoot.fImpl;
-
-    if (impl->treeWalkers != 0L) {
-        int i;
-        int sz = impl->treeWalkers->size();
-        for (i = 0; i < sz; i++)
-            if (impl->treeWalkers->elementAt(i) == this) {
-                impl->treeWalkers->removeElementAt(i);
-                break;
-            }
-    }
-
-    delete this;
-}
-
-
 /** Return the whatToShow value */
-unsigned long TreeWalkerImpl::getWhatToShow () {
+unsigned long IDTreeWalkerImpl::getWhatToShow () {
     return fWhatToShow;
 }
 
 
 /** Return the NodeFilter */
-DOM_NodeFilter* TreeWalkerImpl::getFilter () {
+IDOM_NodeFilter* IDTreeWalkerImpl::getFilter () {
     return fNodeFilter;
 }
 
 /** Get the expandEntity reference flag. */
-bool TreeWalkerImpl::getExpandEntityReferences() {
+bool IDTreeWalkerImpl::getExpandEntityReferences() {
     return fExpandEntityReferences;
 }
 
 
 
 /** Return the current Node. */
-DOM_Node TreeWalkerImpl::getCurrentNode () {
+IDOM_Node* IDTreeWalkerImpl::getCurrentNode () {
 
     return fCurrentNode;
 }
 
 
 /** Return the current Node. */
-void TreeWalkerImpl::setCurrentNode (DOM_Node node) {
+void IDTreeWalkerImpl::setCurrentNode (IDOM_Node* node) {
 
     fCurrentNode = node;
 }
@@ -172,13 +150,11 @@ void TreeWalkerImpl::setCurrentNode (DOM_Node node) {
  *  after applying filter, whatToshow.
  *  If result is not null, set the current Node.
  */
-DOM_Node TreeWalkerImpl::parentNode () {
-
-	DOM_Node result;
+IDOM_Node* IDTreeWalkerImpl::parentNode () {
 
-    if (fCurrentNode.isNull()) return result;
+    if (!fCurrentNode) return 0;
 
-    DOM_Node node = getParentNode(fCurrentNode);
+    IDOM_Node* node = getParentNode(fCurrentNode);
     if (node != 0) {
         fCurrentNode = node;
     }
@@ -191,14 +167,13 @@ DOM_Node TreeWalkerImpl::parentNode () {
  *  after applying filter, whatToshow.
  *  If result is not null, set the current Node.
  */
-DOM_Node TreeWalkerImpl::firstChild () {
+IDOM_Node* IDTreeWalkerImpl::firstChild () {
 
-	DOM_Node result;
+    if (!fCurrentNode) return 0;
 
-    if (fCurrentNode.isNull()) return result;
+    IDOM_Node* node = getFirstChild(fCurrentNode);
 
-    DOM_Node node = getFirstChild(fCurrentNode);
-    if (! node.isNull()) {
+    if (node != 0) {
         fCurrentNode = node;
     }
     return node;
@@ -209,14 +184,12 @@ DOM_Node TreeWalkerImpl::firstChild () {
  *  after applying filter, whatToshow.
  *  If result is not null, set the current Node.
  */
-DOM_Node TreeWalkerImpl::lastChild () {
+IDOM_Node* IDTreeWalkerImpl::lastChild () {
 
-    DOM_Node result;
+    if (!fCurrentNode) return 0;
 
-    if (fCurrentNode.isNull()) return result;
-
-    DOM_Node node = getLastChild(fCurrentNode);
-    if (! node.isNull()) {
+    IDOM_Node* node = getLastChild(fCurrentNode);
+    if (node != 0) {
         fCurrentNode = node;
     }
     return node;
@@ -228,14 +201,12 @@ DOM_Node TreeWalkerImpl::lastChild () {
  *  If result is not null, set the current Node.
  */
 
-DOM_Node TreeWalkerImpl::previousSibling () {
+IDOM_Node* IDTreeWalkerImpl::previousSibling () {
 	
-	DOM_Node result;
+    if (!fCurrentNode) return 0;
 
-    if (fCurrentNode.isNull()) return result;
-
-    DOM_Node node = getPreviousSibling(fCurrentNode);
-    if (! node.isNull()) {
+    IDOM_Node* node = getPreviousSibling(fCurrentNode);
+    if (node != 0) {
         fCurrentNode = node;
     }
     return node;
@@ -247,14 +218,12 @@ DOM_Node TreeWalkerImpl::previousSibling () {
  *  If result is not null, set the current Node.
  */
 
-DOM_Node TreeWalkerImpl::nextSibling () {
+IDOM_Node* IDTreeWalkerImpl::nextSibling () {
 		
-	DOM_Node result;
-
-    if (fCurrentNode.isNull()) return result;
+    if (!fCurrentNode) return 0;
 
-    DOM_Node node = getNextSibling(fCurrentNode);
-    if (! node.isNull()) {
+    IDOM_Node* node = getNextSibling(fCurrentNode);
+    if (node != 0) {
         fCurrentNode = node;
     }
     return node;
@@ -266,40 +235,33 @@ DOM_Node TreeWalkerImpl::nextSibling () {
  *  If result is not null, set the current Node.
  */
 
-DOM_Node TreeWalkerImpl::previousNode () {
+IDOM_Node* IDTreeWalkerImpl::previousNode () {
 	
-    DOM_Node result;
-
-    if (fCurrentNode.isNull()) return result;
+    if (!fCurrentNode) return 0;
 
     // get sibling
-    result = getPreviousSibling(fCurrentNode);
-    if (result.isNull()) {
-        result = getParentNode(fCurrentNode);
-        if (! result.isNull()) {
-            fCurrentNode = result;
-            return fCurrentNode;
+    IDOM_Node* node = getPreviousSibling(fCurrentNode);
+    if (node == 0) {
+        node = getParentNode(fCurrentNode);
+        if ( node != 0) {
+            fCurrentNode = node;
         }
-        return result;
+        return node;
     }
+    else {
 
-    // get the lastChild of result.
-    DOM_Node lastChild  = getLastChild(result);
+        // get the lastChild of result.
+        IDOM_Node* lastChild  = getLastChild(node);
 
-    // if there is a lastChild which passes filters return it.
-    if (! lastChild.isNull()) {
-        fCurrentNode = lastChild;
-        return fCurrentNode;
-    }
-
-    // otherwise return the previous sibling.
-    if (! result.isNull()) {
-        fCurrentNode = result;
+        // if there is a lastChild which passes filters return it.
+        if (lastChild != 0) {
+            fCurrentNode = lastChild;
+        }
+        else {
+            fCurrentNode = node;
+        }
         return fCurrentNode;
     }
-
-    // otherwise return null.
-    return result;
 }
 
 
@@ -308,40 +270,40 @@ DOM_Node TreeWalkerImpl::previousNode () {
  *  If result is not null, set the current Node.
  */
 
-DOM_Node TreeWalkerImpl::nextNode () {
+IDOM_Node* IDTreeWalkerImpl::nextNode () {
 	
-	DOM_Node result;
-
-    if (fCurrentNode.isNull()) return result;
+    if (!fCurrentNode) return 0;
 
-    result = getFirstChild(fCurrentNode);
+    IDOM_Node* node = getFirstChild(fCurrentNode);
 
-    if (! result.isNull()) {
-        fCurrentNode = result;
-        return result;
+    if (node != 0) {
+        fCurrentNode = node;
+        return node;
     }
+    else {
 
-    result = getNextSibling(fCurrentNode);
-
-    if (! result.isNull()) {
-        fCurrentNode = result;
-        return result;
-    }
+        node = getNextSibling(fCurrentNode);
 
-    // return parent's 1st sibling.
-    DOM_Node parent = getParentNode(fCurrentNode);
-    while (! parent.isNull()) {
-        result = getNextSibling(parent);
-        if (! result.isNull()) {
-            fCurrentNode = result;
-            return result;
-        } else {
-            parent = getParentNode(parent);
+        if (node != 0) {
+            fCurrentNode = node;
+            return node;
+        }
+        else {
+
+            // return parent's 1st sibling.
+            IDOM_Node* parent = getParentNode(fCurrentNode);
+            while ( parent != 0) {
+                node = getNextSibling(parent);
+                if (node != 0) {
+                    fCurrentNode = node;
+                    return node;
+                } else {
+                    parent = getParentNode(parent);
+                }
+            }
+            return node;
         }
     }
-
-    // end , return null
-    return result;
 }
 
 
@@ -351,18 +313,16 @@ DOM_Node TreeWalkerImpl::nextNode () {
  *  The current node is not consulted or set.
  */
 
-DOM_Node TreeWalkerImpl::getParentNode (DOM_Node node) {
+IDOM_Node* IDTreeWalkerImpl::getParentNode (IDOM_Node* node) {
 	
-	DOM_Node result;
+    if (!node || node == fRoot) return 0;
 
-    if (node.isNull() || node == fRoot) return result;
-
-    DOM_Node newNode = node.getParentNode();
-    if (newNode.isNull())  return result;
+    IDOM_Node* newNode = node->getParentNode();
+    if (!newNode)  return 0;
 
     short accept = acceptNode(newNode);
 
-    if (accept == DOM_NodeFilter::FILTER_ACCEPT)
+    if (accept == IDOM_NodeFilter::FILTER_ACCEPT)
         return newNode;
 
     return getParentNode(newNode);
@@ -376,36 +336,34 @@ DOM_Node TreeWalkerImpl::getParentNode (DOM_Node node) {
  *  The current node is not consulted or set.
  */
 
-DOM_Node TreeWalkerImpl::getNextSibling (DOM_Node node) {
+IDOM_Node* IDTreeWalkerImpl::getNextSibling (IDOM_Node* node) {
 	
-	DOM_Node result;
-
-    if (node.isNull() || node == fRoot) return result;
+    if (!node || node == fRoot) return 0;
 
-    DOM_Node newNode = node.getNextSibling();
-    if (newNode.isNull()) {
+    IDOM_Node* newNode = node->getNextSibling();
+    if (!newNode) {
 
-        newNode = node.getParentNode();
+        newNode = node->getParentNode();
 
-        if (newNode.isNull() || node == fRoot)  return result;
+        if (!newNode || node == fRoot)  return 0;
 
         short parentAccept = acceptNode(newNode);
 
-        if (parentAccept == DOM_NodeFilter::FILTER_SKIP) {
+        if (parentAccept == IDOM_NodeFilter::FILTER_SKIP) {
             return getNextSibling(newNode);
         }
 
-        return result;
+        return 0;
     }
 
     short accept = acceptNode(newNode);
 
-    if (accept == DOM_NodeFilter::FILTER_ACCEPT)
+    if (accept == IDOM_NodeFilter::FILTER_ACCEPT)
         return newNode;
     else
-    if (accept == DOM_NodeFilter::FILTER_SKIP) {
-        DOM_Node fChild =  getFirstChild(newNode);
-        if (fChild.isNull()) {
+    if (accept == IDOM_NodeFilter::FILTER_SKIP) {
+        IDOM_Node* fChild =  getFirstChild(newNode);
+        if (!fChild) {
             return getNextSibling(newNode);
         }
         return fChild;
@@ -421,35 +379,33 @@ DOM_Node TreeWalkerImpl::getNextSibling (DOM_Node node) {
  *  The current node is not consulted or set.
  */
 
-DOM_Node TreeWalkerImpl::getPreviousSibling (DOM_Node node) {
+IDOM_Node* IDTreeWalkerImpl::getPreviousSibling (IDOM_Node* node) {
 		
-	DOM_Node result;
-
-    if (node.isNull() || node == fRoot) return result;
+    if (!node || node == fRoot) return 0;
 
-    DOM_Node newNode = node.getPreviousSibling();
-    if (newNode.isNull()) {
+    IDOM_Node* newNode = node->getPreviousSibling();
+    if (!newNode) {
 
-        newNode = node.getParentNode();
-        if (newNode.isNull() || node == fRoot)  return result;
+        newNode = node->getParentNode();
+        if (!newNode || node == fRoot)  return 0;
 
         short parentAccept = acceptNode(newNode);
 
-        if (parentAccept == DOM_NodeFilter::FILTER_SKIP) {
+        if (parentAccept == IDOM_NodeFilter::FILTER_SKIP) {
             return getPreviousSibling(newNode);
         }
 
-        return result;
+        return 0;
     }
 
     short accept = acceptNode(newNode);
 
-    if (accept == DOM_NodeFilter::FILTER_ACCEPT)
+    if (accept == IDOM_NodeFilter::FILTER_ACCEPT)
         return newNode;
     else
-    if (accept == DOM_NodeFilter::FILTER_SKIP) {
-        DOM_Node fChild =  getLastChild(newNode);
-        if (fChild.isNull()) {
+    if (accept == IDOM_NodeFilter::FILTER_SKIP) {
+        IDOM_Node* fChild =  getLastChild(newNode);
+        if (!fChild) {
             return getPreviousSibling(newNode);
         }
         return fChild;
@@ -465,22 +421,20 @@ DOM_Node TreeWalkerImpl::getPreviousSibling (DOM_Node node) {
  *  The current node is not consulted or set.
  */
 
-DOM_Node TreeWalkerImpl::getFirstChild (DOM_Node node) {
+IDOM_Node* IDTreeWalkerImpl::getFirstChild (IDOM_Node* node) {
 		
-	DOM_Node result;
+    if (!node) return 0;
 
-    if (node.isNull()) return result;
-
-    DOM_Node newNode = node.getFirstChild();
-    if (newNode.isNull())  return result;
+    IDOM_Node* newNode = node->getFirstChild();
+    if (!newNode)  return 0;
 
     short accept = acceptNode(newNode);
 
-    if (accept == DOM_NodeFilter::FILTER_ACCEPT)
+    if (accept == IDOM_NodeFilter::FILTER_ACCEPT)
         return newNode;
     else
-    if (accept == DOM_NodeFilter::FILTER_SKIP
-        && newNode.hasChildNodes())
+    if (accept == IDOM_NodeFilter::FILTER_SKIP
+        && newNode->hasChildNodes())
     {
         return getFirstChild(newNode);
     }
@@ -494,22 +448,20 @@ DOM_Node TreeWalkerImpl::getFirstChild (DOM_Node node) {
  *  The current node is not consulted or set.
  */
 
-DOM_Node TreeWalkerImpl::getLastChild (DOM_Node node) {
+IDOM_Node* IDTreeWalkerImpl::getLastChild (IDOM_Node* node) {
 	
-	DOM_Node result;
-
-    if (node.isNull()) return result;
+    if (!node) return 0;
 
-    DOM_Node newNode = node.getLastChild();
-    if (newNode.isNull())  return result;
+    IDOM_Node* newNode = node->getLastChild();
+    if (!newNode)  return 0;
 
     short accept = acceptNode(newNode);
 
-    if (accept == DOM_NodeFilter::FILTER_ACCEPT)
+    if (accept == IDOM_NodeFilter::FILTER_ACCEPT)
         return newNode;
     else
-    if (accept == DOM_NodeFilter::FILTER_SKIP
-        && newNode.hasChildNodes())
+    if (accept == IDOM_NodeFilter::FILTER_SKIP
+        && newNode->hasChildNodes())
     {
         return getLastChild(newNode);
     }
@@ -521,27 +473,27 @@ DOM_Node TreeWalkerImpl::getLastChild (DOM_Node node) {
 
 /** The node is accepted if it passes the whatToShow and the filter. */
 
-short TreeWalkerImpl::acceptNode (DOM_Node node) {
+short IDTreeWalkerImpl::acceptNode (IDOM_Node* node) {
 	
     if (fNodeFilter == 0) {
-        if ( ( fWhatToShow & (1 << (node.getNodeType() - 1))) != 0)
+        if ( ( fWhatToShow & (1 << (node->getNodeType() - 1))) != 0)
         {
-            return DOM_NodeFilter::FILTER_ACCEPT;
+            return IDOM_NodeFilter::FILTER_ACCEPT;
         }
         else
         {
-            return DOM_NodeFilter::FILTER_SKIP;
+            return IDOM_NodeFilter::FILTER_SKIP;
         }
     } else {
         // REVISIT: This logic is unclear from the spec!
-        if ((fWhatToShow & (1 << (node.getNodeType() - 1))) != 0 ) {
+        if ((fWhatToShow & (1 << (node->getNodeType() - 1))) != 0 ) {
             return fNodeFilter->acceptNode(node);
         } else {
             // what to show has failed!
-            if (fNodeFilter->acceptNode(node) == DOM_NodeFilter::FILTER_REJECT) {
-                return DOM_NodeFilter::FILTER_REJECT;
+            if (fNodeFilter->acceptNode(node) == IDOM_NodeFilter::FILTER_REJECT) {
+                return IDOM_NodeFilter::FILTER_REJECT;
             } else {
-                return DOM_NodeFilter::FILTER_SKIP;
+                return IDOM_NodeFilter::FILTER_SKIP;
             }
         }
     }
diff --git a/src/idom/IDTreeWalkerImpl.hpp b/src/idom/IDTreeWalkerImpl.hpp
index c135ec7c4c7daedc1b8a714335139d30253bad40..c88400052d3b82dcc41837aaa4f6bfc52474153f 100644
--- a/src/idom/IDTreeWalkerImpl.hpp
+++ b/src/idom/IDTreeWalkerImpl.hpp
@@ -56,6 +56,9 @@
 
 /*
  * $Log$
+ * Revision 1.3  2001/06/04 20:11:53  tng
+ * IDOM: Complete IDNodeIterator, IDTreeWalker, IDNodeFilter.
+ *
  * Revision 1.2  2001/05/11 13:26:00  tng
  * Copyright update.
  *
@@ -64,15 +67,29 @@
  *
  */
 
-#ifndef TreeWalkerImpl_HEADER_GUARD_
-#define TreeWalkerImpl_HEADER_GUARD_
+#ifndef IDTreeWalkerImpl_HEADER_GUARD_
+#define IDTreeWalkerImpl_HEADER_GUARD_
+
+
+#include "IDOM_TreeWalker.hpp"
+
+
+class CDOM_EXPORT IDTreeWalkerImpl : public IDOM_TreeWalker {
+    private:
+        // The whatToShow mask.
+        unsigned long fWhatToShow;
 
+        // The NodeFilter reference.
+        IDOM_NodeFilter* fNodeFilter;
 
-#include "DOM_TreeWalker.hpp"
-#include "RefCountedImpl.hpp"
+        // The current Node.
+        IDOM_Node* fCurrentNode;
 
+        // The root Node.
+        IDOM_Node* fRoot;
 
-class CDOM_EXPORT TreeWalkerImpl : public RefCountedImpl {
+        // The expandEntity reference flag.
+        bool fExpandEntityReferences;
 
 	public:
     // Implementation Note: No state is kept except the data above
@@ -81,66 +98,64 @@ class CDOM_EXPORT TreeWalkerImpl : public RefCountedImpl {
     // implementation will still work.
 
     /** Public constructor */
-    TreeWalkerImpl (
-        DOM_Node root,
+    IDTreeWalkerImpl (
+        IDOM_Node* root,
         unsigned long whatToShow,
-        DOM_NodeFilter* nodeFilter,
+        IDOM_NodeFilter* nodeFilter,
         bool expandEntityRef);
-    TreeWalkerImpl (const TreeWalkerImpl& twi);
-    TreeWalkerImpl& operator= (const TreeWalkerImpl& twi);
+    IDTreeWalkerImpl (const IDTreeWalkerImpl& twi);
+    IDTreeWalkerImpl& operator= (const IDTreeWalkerImpl& twi);
 
     // Return the whatToShow value.
-    unsigned long  getWhatToShow ();
+    virtual unsigned long  getWhatToShow ();
 
     // Return the NodeFilter.
-    DOM_NodeFilter* getFilter ();
+    virtual IDOM_NodeFilter* getFilter ();
 
 	
-    // Return the current DOM_Node.
-    DOM_Node getCurrentNode ();
+    // Return the current IDOM_Node.
+    virtual IDOM_Node* getCurrentNode ();
 
     // Return the current Node.
-    void setCurrentNode (DOM_Node node);
+    virtual void setCurrentNode (IDOM_Node* node);
 
     // Return the parent Node from the current node,
     //  after applying filter, whatToshow.
     //  If result is not null, set the current Node.
-    DOM_Node parentNode ();
+    virtual IDOM_Node* parentNode ();
 
     // Return the first child Node from the current node,
     //  after applying filter, whatToshow.
     //  If result is not null, set the current Node.
-    DOM_Node firstChild ();
+    virtual IDOM_Node* firstChild ();
 
     // Return the last child Node from the current node,
     //  after applying filter, whatToshow.
     //  If result is not null, set the current Node.
-    DOM_Node lastChild ();
+    virtual IDOM_Node* lastChild ();
 
     // Return the previous sibling Node from the current node,
     //  after applying filter, whatToshow.
     //  If result is not null, set the current Node.
-    DOM_Node previousSibling ();
+    virtual IDOM_Node* previousSibling ();
 
     // Return the next sibling Node from the current node,
     //  after applying filter, whatToshow.
     //  If result is not null, set the current Node.
 
-    DOM_Node nextSibling ();
+    virtual IDOM_Node* nextSibling ();
     // Return the previous Node from the current node,
     //  after applying filter, whatToshow.
     //  If result is not null, set the current Node.
-    DOM_Node previousNode ();
+    virtual IDOM_Node* previousNode ();
 
     // Return the next Node from the current node,
     //  after applying filter, whatToshow.
     //  If result is not null, set the current Node.
-    DOM_Node nextNode ();
-
-    void unreferenced ();
+    virtual IDOM_Node* nextNode ();
 
     // Get the expandEntity reference flag.
-    bool getExpandEntityReferences();
+    virtual bool getExpandEntityReferences();
 
 protected:
 
@@ -148,51 +163,36 @@ protected:
     //  Return the parent Node, from the input node
     //  after applying filter, whatToshow.
     //  The current node is not consulted or set.
-    DOM_Node getParentNode (DOM_Node node);
+    IDOM_Node* getParentNode (IDOM_Node* node);
 
     // Internal function.
     //  Return the nextSibling Node, from the input node
     //  after applying filter, whatToshow.
     //  The current node is not consulted or set.
-    DOM_Node getNextSibling (DOM_Node node);
+    IDOM_Node* getNextSibling (IDOM_Node* node);
 
     // Internal function.
     //  Return the previous sibling Node, from the input node
     //  after applying filter, whatToshow.
     //  The current node is not consulted or set.
-    DOM_Node getPreviousSibling (DOM_Node node);
+    IDOM_Node* getPreviousSibling (IDOM_Node* node);
 
     // Internal function.
     //  Return the first child Node, from the input node
     //  after applying filter, whatToshow.
     //  The current node is not consulted or set.
-    DOM_Node getFirstChild (DOM_Node node);
+    IDOM_Node* getFirstChild (IDOM_Node* node);
 
     // Internal function.
     //  Return the last child Node, from the input node
     //  after applying filter, whatToshow.
     //  The current node is not consulted or set.
-    DOM_Node getLastChild (DOM_Node node);
+    IDOM_Node* getLastChild (IDOM_Node* node);
 
     // The node is accepted if it passes the whatToShow and the filter.
-    short acceptNode (DOM_Node node);
+    short acceptNode (IDOM_Node* node);
 
     		
-private:
-    // The whatToShow mask.
-    unsigned long fWhatToShow;
-
-    // The NodeFilter reference.
-    DOM_NodeFilter* fNodeFilter;
-
-    // The current Node.
-    DOM_Node fCurrentNode;
-
-    // The root Node.
-    DOM_Node fRoot;
-
-    // The expandEntity reference flag.
-    bool fExpandEntityReferences;
 };
 
 #endif
diff --git a/src/idom/Makefile.in b/src/idom/Makefile.in
index ac10ab1322aa5373821973a82ada2d22775127d5..f6c4cfd9d30fd998b6f1ffd7a9b79b19b4486418 100644
--- a/src/idom/Makefile.in
+++ b/src/idom/Makefile.in
@@ -126,11 +126,13 @@ IDOM_CPP_PRIVHEADERS =  \
        IDEntityReferenceImpl.hpp \
        IDNamedNodeMapImpl.hpp \
        IDNodeImpl.hpp \
+       IDNodeIteratorImpl.hpp \
        IDNodeListImpl.hpp \
        IDNotationImpl.hpp \
        IDProcessingInstructionImpl.hpp \
        IDRangeImpl.hpp \
        IDTextImpl.hpp \
+       IDTreeWalker.hpp \
        IDXMLDeclImpl.hpp
 
 IDOM_C_FILES = \
@@ -157,6 +159,7 @@ IDOM_CPP_OBJECTS = \
        IDNamedNodeMapImpl.$(TO) \
        IDNodeIDMap.$(TO) \
        IDNodeImpl.$(TO) \
+       IDNodeIteratorImpl.$(TO) \
        IDNodeListImpl.$(TO) \
        IDNodeVector.$(TO) \
        IDNotationImpl.$(TO) \
@@ -167,6 +170,7 @@ IDOM_CPP_OBJECTS = \
        IDRangeImpl.$(TO) \
        IDStringPool.$(TO) \
        IDTextImpl.$(TO) \
+       IDTreeWalker.$(TO) \
        IDXMLDeclImpl.$(TO)
 
 
diff --git a/src/util/Compilers/VCPPDefs.hpp b/src/util/Compilers/VCPPDefs.hpp
index 0fefb9bd1e5bcfa408f02f7406bf7fc69068b2f8..1a3f4aba1fb0981e1872940f592a10d99071ea68 100644
--- a/src/util/Compilers/VCPPDefs.hpp
+++ b/src/util/Compilers/VCPPDefs.hpp
@@ -56,6 +56,9 @@
 
 /*
  * $Log$
+ * Revision 1.13  2001/06/04 20:11:54  tng
+ * IDOM: Complete IDNodeIterator, IDTreeWalker, IDNodeFilter.
+ *
  * Revision 1.12  2001/06/04 13:45:06  tng
  * The "hash" argument clashes with STL hash.  Fixed by Pei Yong Zhang.
  *
@@ -173,9 +176,14 @@ const char* const Xerces_DLLName = "xerces-c_" Xerces_DLLVersionStr;
 
 // ---------------------------------------------------------------------------
 //  For IDOM:
-//  Ignore compiler warning:
+//  Bypass compiler warning:
 //    no matching operator delete found; memory will not be freed if initialization throws an exception
 // ---------------------------------------------------------------------------
-#pragma warning( push )
-#pragma warning( disable : 4291 )
+#if _MSC_VER == 1200 /* VC++ 6.0 */
+class IDOM_Document;
+inline void operator delete(void* ptr, IDOM_Document *doc)
+{
+    return;
+}
+#endif
 
diff --git a/tests/IDom/IRangeTest/IRangeTest.cpp b/tests/IDom/IRangeTest/IRangeTest.cpp
index e7ee4b34cd71d5113b839ab3bc057f27dcde15b6..b94a7c34f6338b531f17c9757c4872db8162633b 100644
--- a/tests/IDom/IRangeTest/IRangeTest.cpp
+++ b/tests/IDom/IRangeTest/IRangeTest.cpp
@@ -240,6 +240,8 @@ int  main()
 
             IDOM_Text*     E210 = doc->createTextNode(xInsertedText);
 
+            delete doc;
+
 
         }
 
@@ -581,387 +583,387 @@ int  main()
             aRange->detach();
             range->detach();
 
-           //***************************************************************
-           //another set of test
-           //TEST createRange, setStart and setEnd, insertnode
-           //***************************************************************
-           IDOM_DOMImplementation* impl2 = IDOM_DOMImplementation::getImplementation();
-           IDOM_Document* doc2 = impl2->createDocument();
-
-           IDOM_Element* root2 = doc2->createElement(xroot2);
-           doc2->appendChild(root2);
-           //case 1: simple text node, start==end
-           // <body>text1</body>
-           IDOM_Element* body = doc2->createElement(xBody);
-           IDOM_Text* text1 = doc2->createTextNode(xtext1);
-           body->appendChild(text1);
-           root2->appendChild(body);
-
-           //set range
-           IDOM_Range* range1 = doc2->createRange();
-           range1->setStart(text1,1);
-           range1->setEnd(text1,3);
-
-           TASSERT(!XMLString::compareString(range1->toString(),xex));
-           TASSERT(range1->getStartOffset()==1);
-           TASSERT(!XMLString::compareString(range1->getStartContainer()->getNodeValue(),xtext1));
-           TASSERT(range1->getEndOffset()==3);
-           TASSERT(!XMLString::compareString(range1->getEndContainer()->getNodeValue(),xtext1));
-
-           //now insert a text node
-           //<body>ttext2ext1</body>
-           IDOM_Text* text2 = doc2->createTextNode(xtext2);
-           range1->insertNode(text2);
-
-           TASSERT(!XMLString::compareString(range1->toString(),xtext2ex));
-           TASSERT(range1->getStartOffset()==1);
-           TASSERT(!XMLString::compareString(range1->getStartContainer()->getNodeValue(),xt));
-           TASSERT(range1->getEndOffset()==2);
-           TASSERT(!XMLString::compareString(range1->getEndContainer()->getNodeValue(),xext1));
-
-           //now insert a non-text node
-           //<body>t<p1/>text2ext1</body>
-           IDOM_Element* p1 = doc2->createElement(xp1);
-           range1->insertNode(p1);
-
-           TASSERT(!XMLString::compareString(range1->toString(),xtext2ex));
-           TASSERT(range1->getStartOffset()==1);
-           TASSERT(!XMLString::compareString(range1->getStartContainer()->getNodeValue(),xt));
-           TASSERT(range1->getEndOffset()==2);
-           TASSERT(!XMLString::compareString(range1->getEndContainer()->getNodeValue(),xext1));
-
-           //case 2: non-text node, start==end
-           // <head><h1/></head>
-           IDOM_Element* head = doc2->createElement(xhead);
-           IDOM_Element* h1 = doc2->createElement(xH1);
-           head->appendChild(h1);
-           root2->appendChild(head);
-
-           //set range
-           IDOM_Range* range2 = doc2->createRange();
-           range2->setStart(head,0);
-           range2->setEnd(head,1);
-
-           TASSERT(!XMLString::compareString(range2->toString(),XMLUni::fgZeroLenString));
-           TASSERT(range2->getStartOffset()==0);
-           TASSERT(!XMLString::compareString(range2->getStartContainer()->getNodeName(),xhead));
-           TASSERT(range2->getEndOffset()==1);
-           TASSERT(!XMLString::compareString(range2->getEndContainer()->getNodeName(),xhead));
-
-           //now insert a non-text node
-           //<head><h2/><h1/></head>
-           IDOM_Element* h2 = doc2->createElement(xh2);
-           range2->insertNode(h2);
-
-           TASSERT(!XMLString::compareString(range2->toString(),XMLUni::fgZeroLenString));
-           TASSERT(range2->getStartOffset()==0);
-           TASSERT(!XMLString::compareString(range2->getStartContainer()->getNodeName(),xhead));
-           TASSERT(range2->getEndOffset()==2);
-           TASSERT(!XMLString::compareString(range2->getEndContainer()->getNodeName(),xhead));
-
-           //now insert a text node
-           //<head>text5<h2/><h1/></head>
-           IDOM_Text* text5 = doc2->createTextNode(xtext5);
-           range2->insertNode(text5);
-
-           TASSERT(!XMLString::compareString(range2->toString(),xtext5));
-           TASSERT(range2->getStartOffset()==0);
-           TASSERT(!XMLString::compareString(range2->getStartContainer()->getNodeName(),xhead));
-           TASSERT(range2->getEndOffset()==3);
-           TASSERT(!XMLString::compareString(range2->getEndContainer()->getNodeName(),xhead));
-
-           //case 3: simple text node, start!=end
-           // <body2>text3</body2>
-           IDOM_Element* body2 = doc2->createElement(xbody2);
-           IDOM_Text* text3 = doc2->createTextNode(xtext3);
-           body2->appendChild(text3);
-           root2->appendChild(body2);
-
-           //set range
-           IDOM_Range* range3 = doc2->createRange();
-           range3->setStart(text3,1);
-           range3->setEnd(body2,1);
-
-           TASSERT(!XMLString::compareString(range3->toString(),xext3));
-           TASSERT(range3->getStartOffset()==1);
-           TASSERT(!XMLString::compareString(range3->getStartContainer()->getNodeValue(),xtext3));
-           TASSERT(range3->getEndOffset()==1);
-           TASSERT(!XMLString::compareString(range3->getEndContainer()->getNodeName(),xbody2));
-
-           //now insert a textnode
-           //<body2>ttext4ext3</body2>
-           IDOM_Text* text4 = doc2->createTextNode(xtext4);
-           range3->insertNode(text4);
-
-           TASSERT(!XMLString::compareString(range3->toString(),XMLUni::fgZeroLenString));
-           TASSERT(range3->getStartOffset()==1);
-           TASSERT(!XMLString::compareString(range3->getStartContainer()->getNodeValue(),xt));
-           TASSERT(range3->getEndOffset()==1);
-           TASSERT(!XMLString::compareString(range3->getEndContainer()->getNodeName(),xbody2));
-
-           //now insert a non-text node
-           //<body2>t<p2/>text4ext3</body2>
-           IDOM_Element* p2 = doc2->createElement(xp2);
-           range3->insertNode(p2);
-
-           //extra empty node caused by splitting 't'
-           TASSERT(!XMLString::compareString(range3->toString(),XMLUni::fgZeroLenString));
-           TASSERT(range3->getStartOffset()==1);
-           TASSERT(!XMLString::compareString(range3->getStartContainer()->getNodeValue(),xt));
-           TASSERT(range3->getEndOffset()==1);
-           TASSERT(!XMLString::compareString(range3->getEndContainer()->getNodeName(),xbody2));
-
-           //test toString a bit
-           range3->setStart(body2,1);
-           range3->setEnd(body2,5);
-
-           TASSERT(!XMLString::compareString(range3->toString(),xtext4ext3));
-
-           range3->setStart(body2,0);
-           range3->setEnd(body2,5);
-
-           TASSERT(!XMLString::compareString(range3->toString(),xttext4ext3));
-
-           //case 4: non-text node, start!=end
-           // <head2><h3/></head2>
-           IDOM_Element* head2 = doc2->createElement(xhead2);
-           IDOM_Element* h3 = doc2->createElement(xh3);
-           head2->appendChild(h3);
-           root2->appendChild(head2);
-
-           //set range
-           IDOM_Range* range4 = doc2->createRange();
-           range4->setStart(head2,0);
-           range4->setEnd(h3,0);
-
-           TASSERT(!XMLString::compareString(range4->toString(),XMLUni::fgZeroLenString));
-           TASSERT(range4->getStartOffset()==0);
-           TASSERT(!XMLString::compareString(range4->getStartContainer()->getNodeName(),xhead2));
-           TASSERT(range4->getEndOffset()==0);
-           TASSERT(!XMLString::compareString(range4->getEndContainer()->getNodeName(),xh3));
-
-           //now insert a non-text node
-           //<head2><h4/><h3/></head2>
-           IDOM_Element* h4 = doc2->createElement(xh4);
-           range4->insertNode(h4);
-
-           TASSERT(!XMLString::compareString(range4->toString(),XMLUni::fgZeroLenString));
-           TASSERT(range4->getStartOffset()==0);
-           TASSERT(!XMLString::compareString(range4->getStartContainer()->getNodeName(),xhead2));
-           TASSERT(range4->getEndOffset()==0);
-           TASSERT(!XMLString::compareString(range4->getEndContainer()->getNodeName(),xh3));
-
-           //now insert a text node
-           //<head2>text6<h4/><h3/></head2>
-           IDOM_Text* text6 = doc2->createTextNode(xtext6);
-           range4->insertNode(text6);
-
-           TASSERT(!XMLString::compareString(range4->toString(),xtext6));
-           TASSERT(range4->getStartOffset()==0);
-           TASSERT(!XMLString::compareString(range4->getStartContainer()->getNodeName(),xhead2));
-           TASSERT(range4->getEndOffset()==0);
-           TASSERT(!XMLString::compareString(range4->getEndContainer()->getNodeName(),xh3));
-
-           //***************************************************************
-           // quick test of updating
-           //***************************************************************
-           // <upbody>text1</upbody>
-           IDOM_Element* upbody = doc2->createElement(xupbody);
-           IDOM_Text* uptext1 = doc2->createTextNode(xuptext1);
-           upbody->appendChild(uptext1);
-           root2->appendChild(upbody);
-
-           IDOM_Range* uprange = doc2->createRange();
-           uprange->setStart(upbody,0);
-           uprange->setEnd(upbody,1);
-
-           TASSERT(!XMLString::compareString(uprange->toString(),xuptext1));
-           TASSERT(uprange->getStartOffset()==0);
-           TASSERT(!XMLString::compareString(uprange->getStartContainer()->getNodeName(),xupbody));
-           TASSERT(uprange->getEndOffset()==1);
-           TASSERT(!XMLString::compareString(uprange->getEndContainer()->getNodeName(),xupbody));
-
-           // split text
-           uptext1->splitText(1);
-
-           TASSERT(!XMLString::compareString(uprange->toString(),xu));
-           TASSERT(uprange->getStartOffset()==0);
-           TASSERT(!XMLString::compareString(uprange->getStartContainer()->getNodeName(),xupbody));
-           TASSERT(uprange->getEndOffset()==1);
-           TASSERT(!XMLString::compareString(uprange->getEndContainer()->getNodeName(),xupbody));
-
-           //insert node
-           IDOM_Element* upbody2 = doc2->createElement(xupbody2);
-           IDOM_Text* uptext2 = doc2->createTextNode(xuptext2);
-           upbody2->appendChild(uptext2);
-           root2->appendChild(upbody2);
-
-           IDOM_Range* uprange2 = doc2->createRange();
-           uprange2->setStart(uptext2,1);
-           uprange2->setEnd(upbody2,1);
-
-           IDOM_Range* uprange3 = doc2->createRange();
-           uprange3->setStart(uptext2,1);
-           uprange3->setEnd(upbody2,1);
-
-           TASSERT(!XMLString::compareString(uprange2->toString(),xptext2));
-           TASSERT(uprange2->getStartOffset()==1);
-           TASSERT(!XMLString::compareString(uprange2->getStartContainer()->getNodeValue(),xuptext2));
-           TASSERT(uprange2->getEndOffset()==1);
-           TASSERT(!XMLString::compareString(uprange2->getEndContainer()->getNodeName(),xupbody2));
-
-           TASSERT(!XMLString::compareString(uprange3->toString(),xptext2));
-           TASSERT(uprange3->getStartOffset()==1);
-           TASSERT(!XMLString::compareString(uprange3->getStartContainer()->getNodeValue(),xuptext2));
-           TASSERT(uprange3->getEndOffset()==1);
-           TASSERT(!XMLString::compareString(uprange3->getEndContainer()->getNodeName(),xupbody2));
-
-           IDOM_Element* upp1 = doc2->createElement(xupp1);
-           uprange2->insertNode(upp1);
-
-           TASSERT(!XMLString::compareString(uprange2->toString(),XMLUni::fgZeroLenString));
-           TASSERT(uprange2->getStartOffset()==1);
-           TASSERT(!XMLString::compareString(uprange2->getStartContainer()->getNodeValue(),xu));
-           TASSERT(uprange2->getEndOffset()==1);
-           TASSERT(!XMLString::compareString(uprange2->getEndContainer()->getNodeName(),xupbody2));
-
-           TASSERT(!XMLString::compareString(uprange3->toString(),XMLUni::fgZeroLenString));
-           TASSERT(uprange3->getStartOffset()==1);
-           TASSERT(!XMLString::compareString(uprange3->getStartContainer()->getNodeValue(),xu));
-           TASSERT(uprange3->getEndOffset()==1);
-           TASSERT(!XMLString::compareString(uprange3->getEndContainer()->getNodeName(),xupbody2));
-
-           //***************************************************************
-           //another set of test
-           //<foo><c/><moo><b/></moo>ab<a>Hello cd</a><cool>ef</cool></foo>
-           //
-           //  ______________________foo_____________________
-           //  |          |           |          |           |
-           //  c         moo        "ab"         a          cool
-           //             |                      |           |
-           //             b                    "Hello cd"   "ef"
-           //
-           IDOM_DOMImplementation* impl3 = IDOM_DOMImplementation::getImplementation();
-           IDOM_Document* doc3 = impl3->createDocument();
-
-           IDOM_Element* root3 = doc3->createElement(xroot);
-           doc3->appendChild(root3);
-
-           IDOM_Element* foo = doc3->createElement(xfoo);
-           IDOM_Element* moo = doc3->createElement(xmoo);
-           IDOM_Element* cool = doc3->createElement(xcool);
-           IDOM_Text* ab = doc3->createTextNode(xab);
-           IDOM_Text* cd = doc3->createTextNode(xHellocd);
-           IDOM_Text* ef = doc3->createTextNode(xef);
-
-           IDOM_Element* a = doc3->createElement(xa);
-           IDOM_Element* b = doc3->createElement(xb);
-           IDOM_Element* c = doc3->createElement(xc);
-
-           root3->appendChild(foo);
-           foo->appendChild(c);
-           foo->appendChild(moo);
-           foo->appendChild(ab);
-           foo->appendChild(a);
-           foo->appendChild(cool);
-           moo->appendChild(b);
-           a->appendChild(cd);
-           cool->appendChild(ef);
-
-           //***************************************************************
-           //TEST toString
-           //***************************************************************
-           IDOM_Range* newtestrange = doc3->createRange();
-           //case 1:
-           //start container is text node
-           //   i) end container is also text node
-           //    a) start==end
-           //    b) start!=end
-           //  ii) end container is not text node
-           //    a) start==end => impossible
-           //    b) start!=end
-           //
-           //case 2:
-           //start container is not text node
-           //   i) end container is text node
-           //    a) start==end => impossible
-           //    b) start!=end
-           //  ii) end container is not text node
-           //    a) start==end
-           //    b) start!=end
-
-           //case 1, i, a
-           newtestrange->setStart( cd, 1 );
-           newtestrange->setEnd( cd, 4 );
-
-           TASSERT(!XMLString::compareString(newtestrange->toString(),xell));
-
-           //case 1, i, b
-           newtestrange->setStart( cd, 1 );
-           newtestrange->setEnd( ef, 2 );
-
-           TASSERT(!XMLString::compareString(newtestrange->toString(),xellocdef));
-
-           //case 1, ii, b
-           newtestrange->setStart( cd, 1 );
-           newtestrange->setEnd( foo, 4 );
-
-           TASSERT(!XMLString::compareString(newtestrange->toString(),xellocd));
-
-           //case 2, i, b
-           newtestrange->setStart( foo, 1 );
-           newtestrange->setEnd( cd, 5 );
-
-           TASSERT(!XMLString::compareString(newtestrange->toString(),xabHello));
-
-           //case 2, ii, a
-           newtestrange->setStart( foo, 1 );
-           newtestrange->setEnd( foo, 4 );
-
-           TASSERT(!XMLString::compareString(newtestrange->toString(),xabHellocd));
-
-           //case 2, ii, b
-           newtestrange->setStart( moo, 1 );
-           newtestrange->setEnd( foo, 4 );
-
-           TASSERT(!XMLString::compareString(newtestrange->toString(),xabHellocd));
-
-           //***************************************************************
-           //test removeChild
-           //***************************************************************
-           IDOM_Range* newrange = doc3->createRange();
-           newrange->setStart( moo, 0 );
-           newrange->setEnd( foo, 4 );
-
-           TASSERT(newrange->getStartOffset()==0);
-           TASSERT(!XMLString::compareString(newrange->getStartContainer()->getNodeName(),xmoo));
-           TASSERT(newrange->getEndOffset()==4);
-           TASSERT(!XMLString::compareString(newrange->getEndContainer()->getNodeName(),xfoo));
-           TASSERT(!XMLString::compareString(newrange->toString(),xabHellocd));
-
-           IDOM_Node* n = newrange->cloneContents();
-           IDOM_NodeList* nol = foo->getChildNodes();
-
-           //removing moo
-           foo->removeChild(nol->item(1));
-           TASSERT(newrange->getStartOffset()==1);
-           TASSERT(!XMLString::compareString(newrange->getStartContainer()->getNodeName(),xfoo));
-           TASSERT(newrange->getEndOffset()==3);
-           TASSERT(!XMLString::compareString(newrange->getEndContainer()->getNodeName(),xfoo));
-           TASSERT(!XMLString::compareString(newrange->toString(),xabHellocd));
-
-           TASSERT(newtestrange->getStartOffset()==1);
-           TASSERT(!XMLString::compareString(newtestrange->getStartContainer()->getNodeName(),xfoo));
-           TASSERT(newtestrange->getEndOffset()==3);
-           TASSERT(!XMLString::compareString(newtestrange->getEndContainer()->getNodeName(),xfoo));
-           TASSERT(!XMLString::compareString(newtestrange->toString(),xabHellocd));
-
-    }
-
-
+            //***************************************************************
+            //another set of test
+            //TEST createRange, setStart and setEnd, insertnode
+            //***************************************************************
+            IDOM_DOMImplementation* impl2 = IDOM_DOMImplementation::getImplementation();
+            IDOM_Document* doc2 = impl2->createDocument();
+
+            IDOM_Element* root2 = doc2->createElement(xroot2);
+            doc2->appendChild(root2);
+            //case 1: simple text node, start==end
+            // <body>text1</body>
+            IDOM_Element* body = doc2->createElement(xBody);
+            IDOM_Text* text1 = doc2->createTextNode(xtext1);
+            body->appendChild(text1);
+            root2->appendChild(body);
+
+            //set range
+            IDOM_Range* range1 = doc2->createRange();
+            range1->setStart(text1,1);
+            range1->setEnd(text1,3);
+
+            TASSERT(!XMLString::compareString(range1->toString(),xex));
+            TASSERT(range1->getStartOffset()==1);
+            TASSERT(!XMLString::compareString(range1->getStartContainer()->getNodeValue(),xtext1));
+            TASSERT(range1->getEndOffset()==3);
+            TASSERT(!XMLString::compareString(range1->getEndContainer()->getNodeValue(),xtext1));
+
+            //now insert a text node
+            //<body>ttext2ext1</body>
+            IDOM_Text* text2 = doc2->createTextNode(xtext2);
+            range1->insertNode(text2);
+
+            TASSERT(!XMLString::compareString(range1->toString(),xtext2ex));
+            TASSERT(range1->getStartOffset()==1);
+            TASSERT(!XMLString::compareString(range1->getStartContainer()->getNodeValue(),xt));
+            TASSERT(range1->getEndOffset()==2);
+            TASSERT(!XMLString::compareString(range1->getEndContainer()->getNodeValue(),xext1));
+
+            //now insert a non-text node
+            //<body>t<p1/>text2ext1</body>
+            IDOM_Element* p1 = doc2->createElement(xp1);
+            range1->insertNode(p1);
+
+            TASSERT(!XMLString::compareString(range1->toString(),xtext2ex));
+            TASSERT(range1->getStartOffset()==1);
+            TASSERT(!XMLString::compareString(range1->getStartContainer()->getNodeValue(),xt));
+            TASSERT(range1->getEndOffset()==2);
+            TASSERT(!XMLString::compareString(range1->getEndContainer()->getNodeValue(),xext1));
+
+            //case 2: non-text node, start==end
+            // <head><h1/></head>
+            IDOM_Element* head = doc2->createElement(xhead);
+            IDOM_Element* h1 = doc2->createElement(xH1);
+            head->appendChild(h1);
+            root2->appendChild(head);
+
+            //set range
+            IDOM_Range* range2 = doc2->createRange();
+            range2->setStart(head,0);
+            range2->setEnd(head,1);
+
+            TASSERT(!XMLString::compareString(range2->toString(),XMLUni::fgZeroLenString));
+            TASSERT(range2->getStartOffset()==0);
+            TASSERT(!XMLString::compareString(range2->getStartContainer()->getNodeName(),xhead));
+            TASSERT(range2->getEndOffset()==1);
+            TASSERT(!XMLString::compareString(range2->getEndContainer()->getNodeName(),xhead));
+
+            //now insert a non-text node
+            //<head><h2/><h1/></head>
+            IDOM_Element* h2 = doc2->createElement(xh2);
+            range2->insertNode(h2);
+
+            TASSERT(!XMLString::compareString(range2->toString(),XMLUni::fgZeroLenString));
+            TASSERT(range2->getStartOffset()==0);
+            TASSERT(!XMLString::compareString(range2->getStartContainer()->getNodeName(),xhead));
+            TASSERT(range2->getEndOffset()==2);
+            TASSERT(!XMLString::compareString(range2->getEndContainer()->getNodeName(),xhead));
+
+            //now insert a text node
+            //<head>text5<h2/><h1/></head>
+            IDOM_Text* text5 = doc2->createTextNode(xtext5);
+            range2->insertNode(text5);
+
+            TASSERT(!XMLString::compareString(range2->toString(),xtext5));
+            TASSERT(range2->getStartOffset()==0);
+            TASSERT(!XMLString::compareString(range2->getStartContainer()->getNodeName(),xhead));
+            TASSERT(range2->getEndOffset()==3);
+            TASSERT(!XMLString::compareString(range2->getEndContainer()->getNodeName(),xhead));
+
+            //case 3: simple text node, start!=end
+            // <body2>text3</body2>
+            IDOM_Element* body2 = doc2->createElement(xbody2);
+            IDOM_Text* text3 = doc2->createTextNode(xtext3);
+            body2->appendChild(text3);
+            root2->appendChild(body2);
+
+            //set range
+            IDOM_Range* range3 = doc2->createRange();
+            range3->setStart(text3,1);
+            range3->setEnd(body2,1);
+
+            TASSERT(!XMLString::compareString(range3->toString(),xext3));
+            TASSERT(range3->getStartOffset()==1);
+            TASSERT(!XMLString::compareString(range3->getStartContainer()->getNodeValue(),xtext3));
+            TASSERT(range3->getEndOffset()==1);
+            TASSERT(!XMLString::compareString(range3->getEndContainer()->getNodeName(),xbody2));
+
+            //now insert a textnode
+            //<body2>ttext4ext3</body2>
+            IDOM_Text* text4 = doc2->createTextNode(xtext4);
+            range3->insertNode(text4);
+
+            TASSERT(!XMLString::compareString(range3->toString(),XMLUni::fgZeroLenString));
+            TASSERT(range3->getStartOffset()==1);
+            TASSERT(!XMLString::compareString(range3->getStartContainer()->getNodeValue(),xt));
+            TASSERT(range3->getEndOffset()==1);
+            TASSERT(!XMLString::compareString(range3->getEndContainer()->getNodeName(),xbody2));
+
+            //now insert a non-text node
+            //<body2>t<p2/>text4ext3</body2>
+            IDOM_Element* p2 = doc2->createElement(xp2);
+            range3->insertNode(p2);
+
+            //extra empty node caused by splitting 't'
+            TASSERT(!XMLString::compareString(range3->toString(),XMLUni::fgZeroLenString));
+            TASSERT(range3->getStartOffset()==1);
+            TASSERT(!XMLString::compareString(range3->getStartContainer()->getNodeValue(),xt));
+            TASSERT(range3->getEndOffset()==1);
+            TASSERT(!XMLString::compareString(range3->getEndContainer()->getNodeName(),xbody2));
+
+            //test toString a bit
+            range3->setStart(body2,1);
+            range3->setEnd(body2,5);
+
+            TASSERT(!XMLString::compareString(range3->toString(),xtext4ext3));
+
+            range3->setStart(body2,0);
+            range3->setEnd(body2,5);
+
+            TASSERT(!XMLString::compareString(range3->toString(),xttext4ext3));
+
+            //case 4: non-text node, start!=end
+            // <head2><h3/></head2>
+            IDOM_Element* head2 = doc2->createElement(xhead2);
+            IDOM_Element* h3 = doc2->createElement(xh3);
+            head2->appendChild(h3);
+            root2->appendChild(head2);
+
+            //set range
+            IDOM_Range* range4 = doc2->createRange();
+            range4->setStart(head2,0);
+            range4->setEnd(h3,0);
+
+            TASSERT(!XMLString::compareString(range4->toString(),XMLUni::fgZeroLenString));
+            TASSERT(range4->getStartOffset()==0);
+            TASSERT(!XMLString::compareString(range4->getStartContainer()->getNodeName(),xhead2));
+            TASSERT(range4->getEndOffset()==0);
+            TASSERT(!XMLString::compareString(range4->getEndContainer()->getNodeName(),xh3));
+
+            //now insert a non-text node
+            //<head2><h4/><h3/></head2>
+            IDOM_Element* h4 = doc2->createElement(xh4);
+            range4->insertNode(h4);
+
+            TASSERT(!XMLString::compareString(range4->toString(),XMLUni::fgZeroLenString));
+            TASSERT(range4->getStartOffset()==0);
+            TASSERT(!XMLString::compareString(range4->getStartContainer()->getNodeName(),xhead2));
+            TASSERT(range4->getEndOffset()==0);
+            TASSERT(!XMLString::compareString(range4->getEndContainer()->getNodeName(),xh3));
+
+            //now insert a text node
+            //<head2>text6<h4/><h3/></head2>
+            IDOM_Text* text6 = doc2->createTextNode(xtext6);
+            range4->insertNode(text6);
+
+            TASSERT(!XMLString::compareString(range4->toString(),xtext6));
+            TASSERT(range4->getStartOffset()==0);
+            TASSERT(!XMLString::compareString(range4->getStartContainer()->getNodeName(),xhead2));
+            TASSERT(range4->getEndOffset()==0);
+            TASSERT(!XMLString::compareString(range4->getEndContainer()->getNodeName(),xh3));
+
+            //***************************************************************
+            // quick test of updating
+            //***************************************************************
+            // <upbody>text1</upbody>
+            IDOM_Element* upbody = doc2->createElement(xupbody);
+            IDOM_Text* uptext1 = doc2->createTextNode(xuptext1);
+            upbody->appendChild(uptext1);
+            root2->appendChild(upbody);
+
+            IDOM_Range* uprange = doc2->createRange();
+            uprange->setStart(upbody,0);
+            uprange->setEnd(upbody,1);
+
+            TASSERT(!XMLString::compareString(uprange->toString(),xuptext1));
+            TASSERT(uprange->getStartOffset()==0);
+            TASSERT(!XMLString::compareString(uprange->getStartContainer()->getNodeName(),xupbody));
+            TASSERT(uprange->getEndOffset()==1);
+            TASSERT(!XMLString::compareString(uprange->getEndContainer()->getNodeName(),xupbody));
+
+            // split text
+            uptext1->splitText(1);
+
+            TASSERT(!XMLString::compareString(uprange->toString(),xu));
+            TASSERT(uprange->getStartOffset()==0);
+            TASSERT(!XMLString::compareString(uprange->getStartContainer()->getNodeName(),xupbody));
+            TASSERT(uprange->getEndOffset()==1);
+            TASSERT(!XMLString::compareString(uprange->getEndContainer()->getNodeName(),xupbody));
+
+            //insert node
+            IDOM_Element* upbody2 = doc2->createElement(xupbody2);
+            IDOM_Text* uptext2 = doc2->createTextNode(xuptext2);
+            upbody2->appendChild(uptext2);
+            root2->appendChild(upbody2);
+
+            IDOM_Range* uprange2 = doc2->createRange();
+            uprange2->setStart(uptext2,1);
+            uprange2->setEnd(upbody2,1);
+
+            IDOM_Range* uprange3 = doc2->createRange();
+            uprange3->setStart(uptext2,1);
+            uprange3->setEnd(upbody2,1);
+
+            TASSERT(!XMLString::compareString(uprange2->toString(),xptext2));
+            TASSERT(uprange2->getStartOffset()==1);
+            TASSERT(!XMLString::compareString(uprange2->getStartContainer()->getNodeValue(),xuptext2));
+            TASSERT(uprange2->getEndOffset()==1);
+            TASSERT(!XMLString::compareString(uprange2->getEndContainer()->getNodeName(),xupbody2));
+
+            TASSERT(!XMLString::compareString(uprange3->toString(),xptext2));
+            TASSERT(uprange3->getStartOffset()==1);
+            TASSERT(!XMLString::compareString(uprange3->getStartContainer()->getNodeValue(),xuptext2));
+            TASSERT(uprange3->getEndOffset()==1);
+            TASSERT(!XMLString::compareString(uprange3->getEndContainer()->getNodeName(),xupbody2));
+
+            IDOM_Element* upp1 = doc2->createElement(xupp1);
+            uprange2->insertNode(upp1);
+
+            TASSERT(!XMLString::compareString(uprange2->toString(),XMLUni::fgZeroLenString));
+            TASSERT(uprange2->getStartOffset()==1);
+            TASSERT(!XMLString::compareString(uprange2->getStartContainer()->getNodeValue(),xu));
+            TASSERT(uprange2->getEndOffset()==1);
+            TASSERT(!XMLString::compareString(uprange2->getEndContainer()->getNodeName(),xupbody2));
+
+            TASSERT(!XMLString::compareString(uprange3->toString(),XMLUni::fgZeroLenString));
+            TASSERT(uprange3->getStartOffset()==1);
+            TASSERT(!XMLString::compareString(uprange3->getStartContainer()->getNodeValue(),xu));
+            TASSERT(uprange3->getEndOffset()==1);
+            TASSERT(!XMLString::compareString(uprange3->getEndContainer()->getNodeName(),xupbody2));
+
+            //***************************************************************
+            //another set of test
+            //<foo><c/><moo><b/></moo>ab<a>Hello cd</a><cool>ef</cool></foo>
+            //
+            //  ______________________foo_____________________
+            //  |          |           |          |           |
+            //  c         moo        "ab"         a          cool
+            //             |                      |           |
+            //             b                    "Hello cd"   "ef"
+            //
+            IDOM_DOMImplementation* impl3 = IDOM_DOMImplementation::getImplementation();
+            IDOM_Document* doc3 = impl3->createDocument();
+
+            IDOM_Element* root3 = doc3->createElement(xroot);
+            doc3->appendChild(root3);
+
+            IDOM_Element* foo = doc3->createElement(xfoo);
+            IDOM_Element* moo = doc3->createElement(xmoo);
+            IDOM_Element* cool = doc3->createElement(xcool);
+            IDOM_Text* ab = doc3->createTextNode(xab);
+            IDOM_Text* cd = doc3->createTextNode(xHellocd);
+            IDOM_Text* ef = doc3->createTextNode(xef);
+
+            IDOM_Element* a = doc3->createElement(xa);
+            IDOM_Element* b = doc3->createElement(xb);
+            IDOM_Element* c = doc3->createElement(xc);
+
+            root3->appendChild(foo);
+            foo->appendChild(c);
+            foo->appendChild(moo);
+            foo->appendChild(ab);
+            foo->appendChild(a);
+            foo->appendChild(cool);
+            moo->appendChild(b);
+            a->appendChild(cd);
+            cool->appendChild(ef);
+
+            //***************************************************************
+            //TEST toString
+            //***************************************************************
+            IDOM_Range* newtestrange = doc3->createRange();
+            //case 1:
+            //start container is text node
+            //   i) end container is also text node
+            //    a) start==end
+            //    b) start!=end
+            //  ii) end container is not text node
+            //    a) start==end => impossible
+            //    b) start!=end
+            //
+            //case 2:
+            //start container is not text node
+            //   i) end container is text node
+            //    a) start==end => impossible
+            //    b) start!=end
+            //  ii) end container is not text node
+            //    a) start==end
+            //    b) start!=end
+
+            //case 1, i, a
+            newtestrange->setStart( cd, 1 );
+            newtestrange->setEnd( cd, 4 );
+
+            TASSERT(!XMLString::compareString(newtestrange->toString(),xell));
+
+            //case 1, i, b
+            newtestrange->setStart( cd, 1 );
+            newtestrange->setEnd( ef, 2 );
+
+            TASSERT(!XMLString::compareString(newtestrange->toString(),xellocdef));
+
+            //case 1, ii, b
+            newtestrange->setStart( cd, 1 );
+            newtestrange->setEnd( foo, 4 );
+
+            TASSERT(!XMLString::compareString(newtestrange->toString(),xellocd));
+
+            //case 2, i, b
+            newtestrange->setStart( foo, 1 );
+            newtestrange->setEnd( cd, 5 );
+
+            TASSERT(!XMLString::compareString(newtestrange->toString(),xabHello));
+
+            //case 2, ii, a
+            newtestrange->setStart( foo, 1 );
+            newtestrange->setEnd( foo, 4 );
+
+            TASSERT(!XMLString::compareString(newtestrange->toString(),xabHellocd));
+
+            //case 2, ii, b
+            newtestrange->setStart( moo, 1 );
+            newtestrange->setEnd( foo, 4 );
+
+            TASSERT(!XMLString::compareString(newtestrange->toString(),xabHellocd));
+
+            //***************************************************************
+            //test removeChild
+            //***************************************************************
+            IDOM_Range* newrange = doc3->createRange();
+            newrange->setStart( moo, 0 );
+            newrange->setEnd( foo, 4 );
+
+            TASSERT(newrange->getStartOffset()==0);
+            TASSERT(!XMLString::compareString(newrange->getStartContainer()->getNodeName(),xmoo));
+            TASSERT(newrange->getEndOffset()==4);
+            TASSERT(!XMLString::compareString(newrange->getEndContainer()->getNodeName(),xfoo));
+            TASSERT(!XMLString::compareString(newrange->toString(),xabHellocd));
+
+            IDOM_Node* n = newrange->cloneContents();
+            IDOM_NodeList* nol = foo->getChildNodes();
+
+            //removing moo
+            foo->removeChild(nol->item(1));
+            TASSERT(newrange->getStartOffset()==1);
+            TASSERT(!XMLString::compareString(newrange->getStartContainer()->getNodeName(),xfoo));
+            TASSERT(newrange->getEndOffset()==3);
+            TASSERT(!XMLString::compareString(newrange->getEndContainer()->getNodeName(),xfoo));
+            TASSERT(!XMLString::compareString(newrange->toString(),xabHellocd));
+
+            TASSERT(newtestrange->getStartOffset()==1);
+            TASSERT(!XMLString::compareString(newtestrange->getStartContainer()->getNodeName(),xfoo));
+            TASSERT(newtestrange->getEndOffset()==3);
+            TASSERT(!XMLString::compareString(newtestrange->getEndContainer()->getNodeName(),xfoo));
+            TASSERT(!XMLString::compareString(newtestrange->toString(),xabHellocd));
+
+            delete doc;
+            delete doc2;
+            delete doc3;
+        }
     } //creating the dom tree and tests
 
-
     // And call the termination method
     XMLPlatformUtils::Terminate();
 
diff --git a/tests/IDom/ITraversal/ITraversal.cpp b/tests/IDom/ITraversal/ITraversal.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..4639044d76f097b912fb0db22030082057a18126
--- /dev/null
+++ b/tests/IDom/ITraversal/ITraversal.cpp
@@ -0,0 +1,553 @@
+/*
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2001 The Apache Software Foundation.  All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ *    if any, must include the following acknowledgment:
+ *       "This product includes software developed by the
+ *        Apache Software Foundation (http://www.apache.org/)."
+ *    Alternately, this acknowledgment may appear in the software itself,
+ *    if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Xerces" and "Apache Software Foundation" must
+ *    not be used to endorse or promote products derived from this
+ *    software without prior written permission. For written
+ *    permission, please contact apache\@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ *    nor may "Apache" appear in their name, without prior written
+ *    permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation, and was
+ * originally based on software copyright (c) 2001, International
+ * Business Machines, Inc., http://www.ibm.com .  For more information
+ * on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
+//
+//  Various IDOM tests.
+//     Contents include
+//       1.  NodeIterator tests
+//       2.  Tree Walker tests
+//     All individual are wrapped in a memory leak checker.
+//
+//     This is NOT a complete test of DOM functionality.
+//
+
+/**
+ * $Log$
+ * Revision 1.1  2001/06/04 20:11:55  tng
+ * IDOM: Complete IDNodeIterator, IDTreeWalker, IDNodeFilter.
+ *
+ *
+
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <idom/IDOM.hpp>
+#include <util/PlatformUtils.hpp>
+#include <util/XMLException.hpp>
+#include <util/XMLString.hpp>
+#include <util/XMLUniDefs.hpp>
+
+
+#define TASSERT(c) tassert((c), __FILE__, __LINE__)
+
+void tassert(bool c, char *file, int line)
+{
+    if (!c)
+        printf("Failure.  Line %d,   file %s\n", line, file);
+};
+
+
+#define EXCEPTION_TEST(operation, expected_exception)               \
+{                                                                   \
+    try {                                                           \
+    operation;                                                      \
+    printf(" Error: no exception thrown at line %d\n", __LINE__);   \
+}                                                                   \
+    catch (IDOM_DOMException &e) {                                       \
+    if (e.code != expected_exception)                       \
+    printf(" Wrong exception code: %d at line %d\n", e.code, __LINE__); \
+}                                                                 \
+    catch (...)   {                                                 \
+    printf(" Wrong exception thrown at line %d\n", __LINE__);       \
+}                                                                   \
+}
+
+class  MyFilter : public IDOM_NodeFilter {
+public:
+
+  MyFilter(short nodeType, bool reject=false) : IDOM_NodeFilter(), fNodeType(nodeType), fReject(reject) {};
+  virtual short acceptNode(const IDOM_Node* node) const;
+private:
+    short fNodeType;
+    bool fReject;
+};
+/*
+        Node Types can be of the following:
+        ELEMENT_NODE         = 1,
+        ATTRIBUTE_NODE       = 2,
+        TEXT_NODE            = 3,
+        CDATA_SECTION_NODE   = 4,
+        ENTITY_REFERENCE_NODE = 5,
+        ENTITY_NODE          = 6,
+        PROCESSING_INSTRUCTION_NODE = 7,
+        COMMENT_NODE         = 8,
+        DOCUMENT_NODE        = 9,
+        DOCUMENT_TYPE_NODE   = 10,
+        DOCUMENT_FRAGMENT_NODE = 11,
+        NOTATION_NODE        = 12
+*/
+short  MyFilter::acceptNode(const IDOM_Node* node) const {
+    if (fNodeType == 0)
+        return  IDOM_NodeFilter::FILTER_ACCEPT;
+	if (node->getNodeType() ==  fNodeType) {
+       	return  IDOM_NodeFilter::FILTER_ACCEPT;
+	} else {
+	    return  fReject ? IDOM_NodeFilter::FILTER_REJECT : IDOM_NodeFilter::FILTER_SKIP;
+	}
+}
+
+
+
+int  main()
+{
+	try {
+		XMLPlatformUtils::Initialize();
+	}
+	catch (const XMLException& toCatch) {
+        char *pMessage = XMLString::transcode(toCatch.getMessage());
+        fprintf(stderr, "Error during XMLPlatformUtils::Initialize(). \n"
+                        "  Message is: %s\n", pMessage);
+        delete [] pMessage;
+        return -1;
+    }
+
+    // Create a XMLCh buffer for string manipulation
+    XMLCh tempStr[4000];
+
+
+    //
+    //  Doc - Create a small document tree
+    //
+
+    {
+        //creating a DOM Tree
+         /* Tests are based on the tree structure below
+           doc - root - E11 (attr01) - textNode1
+                                     - E111
+                                     - E112
+                                     - cdataSec
+                      - E12 (attr02) - textNode2
+                                     - E121
+                                     - E122
+                      - E13          - E131
+                                     - docPI
+                      - comment
+         */
+
+        IDOM_DOMImplementation* impl = IDOM_DOMImplementation::getImplementation();
+        IDOM_Document* doc = impl->createDocument();
+
+        //Creating a root element
+        XMLString::transcode("RootElement", tempStr, 3999);
+        IDOM_Element*     root = doc->createElement(tempStr);
+        doc->appendChild(root);
+
+        //Creating the siblings of root
+        XMLString::transcode("FirstSibling", tempStr, 3999);
+        IDOM_Element*     E11 = doc->createElement(tempStr);
+        root->appendChild(E11);
+
+        XMLString::transcode("SecondSibling", tempStr, 3999);
+        IDOM_Element*     E12 = doc->createElement(tempStr);
+        root->appendChild(E12);
+
+        XMLString::transcode("ThirdSibling", tempStr, 3999);
+        IDOM_Element*     E13 = doc->createElement(tempStr);
+        root->appendChild(E13);
+
+        //Attaching texts to few siblings
+        XMLString::transcode("Text1", tempStr, 3999);
+        IDOM_Text*        textNode1 = doc->createTextNode(tempStr);
+        E11->appendChild(textNode1);
+
+        XMLString::transcode("Text2", tempStr, 3999);
+        IDOM_Text*        textNode2 = doc->createTextNode(tempStr);
+        E12->appendChild(textNode2);
+
+        //creating child of siblings
+        XMLString::transcode("FirstSiblingChild1", tempStr, 3999);
+        IDOM_Element*     E111 = doc->createElement(tempStr);
+        E11->appendChild(E111);
+
+        XMLString::transcode("Attr01", tempStr, 3999);
+        IDOM_Attr*        attr01  = doc->createAttribute(tempStr);
+        E11->setAttributeNode(attr01);
+
+        XMLString::transcode("FirstSiblingChild2", tempStr, 3999);
+        IDOM_Element*     E112 = doc->createElement(tempStr);
+        E11->appendChild(E112);
+
+        XMLString::transcode("SecondSiblingChild1", tempStr, 3999);
+        IDOM_Element*     E121 = doc->createElement(tempStr);
+        E12->appendChild(E121);
+
+        XMLString::transcode("Attr01", tempStr, 3999);
+        IDOM_Attr* attr02 = doc->createAttribute(tempStr);
+        E12->setAttributeNode(attr02);
+
+        XMLString::transcode("SecondSiblingChild2", tempStr, 3999);
+        IDOM_Element*     E122 = doc->createElement(tempStr);
+        E12->appendChild(E122);
+
+        XMLString::transcode("ThirdSiblingChild1", tempStr, 3999);
+        IDOM_Element*     E131 = doc->createElement(tempStr);
+        E13->appendChild(E131);
+
+        XMLString::transcode("DocComment", tempStr, 3999);
+        IDOM_Comment* comment = doc->createComment(tempStr);
+        root->appendChild(comment);
+
+        XMLString::transcode("DocCDataSection", tempStr, 3999);
+        IDOM_CDATASection*  cdataSec = doc->createCDATASection(tempStr);
+        E11->appendChild(cdataSec);
+
+        XMLString::transcode("DocPI", tempStr, 3999);
+        XMLCh piStr[] = {chLatin_D, chLatin_o, chLatin_c, chLatin_P, chLatin_I, chNull};
+        IDOM_ProcessingInstruction*  docPI = doc->createProcessingInstruction(piStr, tempStr);
+        E13->appendChild(docPI);
+
+
+        /*
+        following are whatToShow types:
+            SHOW_ALL                       = 0x0000FFFF,
+            SHOW_ELEMENT                   = 0x00000001,
+            SHOW_ATTRIBUTE                 = 0x00000002,
+            SHOW_TEXT                      = 0x00000004,
+            SHOW_CDATA_SECTION             = 0x00000008,
+            SHOW_ENTITY_REFERENCE          = 0x00000010,
+            SHOW_ENTITY                    = 0x00000020,
+            SHOW_PROCESSING_INSTRUCTION    = 0x00000040,
+            SHOW_COMMENT                   = 0x00000080,
+            SHOW_DOCUMENT                  = 0x00000100,
+            SHOW_DOCUMENT_TYPE             = 0x00000200,
+            SHOW_DOCUMENT_FRAGMENT         = 0x00000400,
+            SHOW_NOTATION                  = 0x00000800
+        */
+
+        ////////// NodeIterator Test Cases ////////////////
+
+
+        {
+            // all node iterating test
+
+            IDOM_Node*    node = doc->getFirstChild();
+            unsigned long       whatToShow = IDOM_NodeFilter::SHOW_ALL;
+            MyFilter* filter = new MyFilter(0);
+
+            IDOM_NodeIterator*  iter = doc->createNodeIterator(root, whatToShow,  filter, true);
+            TASSERT(iter->getWhatToShow() == 65535);
+            TASSERT(iter->getExpandEntityReferences() == 1);
+
+            IDOM_Node*  nd;
+            nd = iter->nextNode();
+            TASSERT (nd ==root);
+            nd = iter->nextNode();
+            TASSERT (nd ==E11);
+            nd = iter->nextNode();
+            TASSERT(nd == textNode1);
+            nd = iter->nextNode();
+            TASSERT(nd == E111);
+            nd = iter->nextNode();
+            TASSERT(nd == E112);
+            nd = iter->nextNode();
+            TASSERT(nd == cdataSec);
+            nd = iter->nextNode();
+            TASSERT(nd == E12);
+            nd = iter->nextNode();
+            TASSERT(nd == textNode2);
+            nd = iter->nextNode();
+            TASSERT(nd == E121);
+            nd = iter->nextNode();
+            TASSERT(nd == E122);
+            nd = iter->nextNode();
+            TASSERT(nd == E13);
+            nd = iter->nextNode();
+            TASSERT(nd == E131);
+            nd = iter->nextNode();
+            TASSERT(nd == docPI);
+            nd = iter->nextNode();
+            TASSERT(nd == comment);
+            nd = iter->previousNode();
+            TASSERT(nd == comment);
+            nd = iter->previousNode();
+            TASSERT(nd == docPI);
+            nd = iter->previousNode();
+            TASSERT(nd == E131);
+
+        }
+
+
+
+        {
+            //element node iterating test
+
+            IDOM_Node*    node = doc->getFirstChild();
+            unsigned long       whatToShow = IDOM_NodeFilter::SHOW_ELEMENT;
+            MyFilter* filter = new MyFilter(IDOM_Node::ELEMENT_NODE);
+
+            IDOM_NodeIterator*  iter = doc->createNodeIterator(root, whatToShow,  filter, true);
+            TASSERT(iter->getWhatToShow() == 1);
+            TASSERT(iter->getExpandEntityReferences() == 1);
+
+            IDOM_Node*  nd;
+            nd = iter->nextNode();
+            TASSERT (nd ==root);
+            nd = iter->nextNode();
+            TASSERT (nd ==E11);
+            nd = iter->nextNode();
+            TASSERT(nd == E111);
+            nd = iter->nextNode();
+            TASSERT(nd == E112);
+            nd = iter->nextNode();
+            TASSERT(nd == E12);
+            nd = iter->nextNode();
+            TASSERT(nd == E121);
+            nd = iter->nextNode();
+            TASSERT(nd == E122);
+            nd = iter->nextNode();
+            TASSERT(nd == E13);
+            nd = iter->nextNode();
+            TASSERT(nd == E131);
+            nd = iter->previousNode();
+            TASSERT(nd == E131);
+            nd = iter->previousNode();
+            TASSERT(nd == E13);
+            nd = iter->previousNode();
+            TASSERT(nd == E122);
+        }
+
+
+
+
+
+        {
+            // Text node iterating test
+
+            IDOM_Node*    node = doc->getFirstChild();
+            unsigned long       whatToShow = IDOM_NodeFilter::SHOW_TEXT;
+            MyFilter* filter = new MyFilter(IDOM_Node::TEXT_NODE);
+
+            IDOM_NodeIterator*  iter = doc->createNodeIterator(root, whatToShow,  filter, true);
+
+            TASSERT(iter->getWhatToShow() == 4);
+            TASSERT(iter->getExpandEntityReferences() == 1);
+
+            IDOM_Node*  nd;
+            nd = iter->nextNode();
+            TASSERT (nd ==textNode1);
+            nd = iter->nextNode();
+            TASSERT (nd ==textNode2);
+            nd = iter->previousNode();
+            TASSERT(nd == textNode2);
+
+        }
+
+
+        {
+            //CDataSection node itearating test
+
+            IDOM_Node*    node = doc->getFirstChild();
+            unsigned long       whatToShow = IDOM_NodeFilter::SHOW_CDATA_SECTION;
+            MyFilter* filter = new MyFilter(IDOM_Node::CDATA_SECTION_NODE);
+
+            IDOM_NodeIterator*  iter = doc->createNodeIterator(root, whatToShow,  filter, true);
+            TASSERT(iter->getWhatToShow() == 8);
+            TASSERT(iter->getExpandEntityReferences() == 1);
+
+            IDOM_Node*  nd;
+            nd = iter->nextNode();
+            TASSERT(nd == cdataSec);
+            nd = iter->nextNode();
+            TASSERT(nd == 0);
+
+        }
+
+
+        {
+            // PI nodes iterating test
+
+            IDOM_Node*    node = doc->getFirstChild();
+            unsigned long       whatToShow = IDOM_NodeFilter::SHOW_PROCESSING_INSTRUCTION;
+            MyFilter* filter = new MyFilter(IDOM_Node::PROCESSING_INSTRUCTION_NODE);
+
+            IDOM_NodeIterator*  iter = doc->createNodeIterator(root, whatToShow,  filter, true);
+            TASSERT(iter->getWhatToShow() == 64);
+            TASSERT(iter->getExpandEntityReferences() == 1);
+
+            IDOM_Node*  nd;
+            nd = iter->nextNode();
+            TASSERT(nd == docPI);
+            nd = iter->nextNode();
+            TASSERT(nd == 0);
+
+
+        }
+
+
+
+        {
+            IDOM_Node*    node = doc->getFirstChild();
+            unsigned long       whatToShow = IDOM_NodeFilter::SHOW_COMMENT;
+            MyFilter* filter = new MyFilter(IDOM_Node::COMMENT_NODE);
+
+            IDOM_NodeIterator*  iter = doc->createNodeIterator(root, whatToShow,  filter, true);
+            TASSERT(iter->getWhatToShow() == 128);
+            TASSERT(iter->getExpandEntityReferences() == 1);
+
+            IDOM_Node*  nd;
+            nd = iter->nextNode();
+            TASSERT(nd == comment);
+            nd = iter->nextNode();
+            TASSERT(nd == 0);
+
+        }
+
+
+
+
+        ////////// TreeWalker Test Cases ////////////////
+
+
+
+        {
+            unsigned long whatToShow = IDOM_NodeFilter::SHOW_ALL;
+            IDOM_TreeWalker* tw = doc->createTreeWalker(doc, whatToShow, 0, true);
+
+            TASSERT(tw->getCurrentNode() == doc);
+            TASSERT(tw->firstChild() == root);
+            TASSERT(tw->nextSibling() == 0);
+            TASSERT(tw->lastChild() == comment);
+            TASSERT(tw->firstChild() == 0);
+            TASSERT(tw->lastChild() == 0);
+            TASSERT(tw->nextSibling() == 0);
+            TASSERT(tw->nextNode() == 0);
+            TASSERT(tw->previousSibling() == E13);
+            TASSERT(tw->previousNode() == E122);
+            TASSERT(tw->parentNode() == E12);
+            TASSERT(tw->firstChild() == textNode2);
+            TASSERT(tw->previousSibling() == 0);
+            TASSERT(tw->nextSibling() == E121);
+            TASSERT(tw->nextNode() == E122);
+            TASSERT(tw->parentNode() == E12);
+            TASSERT(tw->previousSibling() == E11);
+            TASSERT(tw->previousNode() == root);
+            TASSERT(tw->previousNode() == doc);
+            TASSERT(tw->previousNode() == 0);
+            TASSERT(tw->parentNode() == 0);
+            TASSERT(tw->getCurrentNode() == doc);
+        }
+
+
+
+        {
+            MyFilter mf(IDOM_Node::ELEMENT_NODE);
+            unsigned long whatToShow = IDOM_NodeFilter::SHOW_ALL;
+            IDOM_TreeWalker* tw = doc->createTreeWalker(root, whatToShow, &mf, true);
+
+            TASSERT(tw->getCurrentNode() == root);
+            TASSERT(tw->parentNode() == 0);  //should not change currentNode
+            TASSERT(tw->getCurrentNode() == root);
+            TASSERT(tw->nextNode() == E11);
+            TASSERT(tw->nextNode() == E111);
+            tw->setCurrentNode(E12);
+            //when first is not visible, should it go to its sibling?
+            TASSERT(tw->firstChild() == E121);   //first visible child
+            TASSERT(tw->previousSibling() == 0);
+        }
+
+
+
+        {
+            MyFilter mf(IDOM_Node::ELEMENT_NODE, true);
+            unsigned long whatToShow = IDOM_NodeFilter::SHOW_ELEMENT;
+            IDOM_TreeWalker* tw = doc->createTreeWalker(root, whatToShow, &mf, true);
+
+            tw->setCurrentNode(E12);
+            TASSERT(tw->firstChild() == E121);   //still first visible child
+        }
+
+
+
+        {
+            MyFilter mf(IDOM_Node::TEXT_NODE);
+            unsigned long whatToShow = IDOM_NodeFilter::SHOW_TEXT;
+            IDOM_TreeWalker* tw = doc->createTreeWalker(root, whatToShow, &mf, true);
+
+            //when first is not visible, should it go to its descendent?
+            TASSERT(tw->firstChild() == textNode1);   //E11 skipped
+            TASSERT(tw->firstChild() == 0);
+            TASSERT(tw->nextNode() == textNode2);
+            TASSERT(tw->nextSibling() == 0);
+            TASSERT(tw->parentNode() == 0);  //no visible ancestor
+            TASSERT(tw->getCurrentNode() == textNode2);
+            tw->setCurrentNode(root);
+            //when last is not visible, should it go to its sibling & descendent?
+            TASSERT(tw->lastChild() == textNode2);   //last visible child
+            tw->setCurrentNode(E12);
+            //when next sibling is not visible, should it go to its descendent?
+            TASSERT(tw->nextSibling() == 0);
+        }
+
+
+
+        {
+            MyFilter mf(IDOM_Node::TEXT_NODE, true);
+            unsigned long whatToShow = IDOM_NodeFilter::SHOW_TEXT;
+            IDOM_TreeWalker* tw = doc->createTreeWalker(root, whatToShow, &mf, true);
+
+            TASSERT(tw->firstChild() == 0);   //E11 rejected and no children is TEXT
+            TASSERT(tw->getCurrentNode() == root);
+            TASSERT(tw->nextNode() == 0);    //E11 rejected so can't get to textNode1
+        }
+
+
+    };
+
+
+    return 0;
+    };
+
diff --git a/tests/IDom/ITraversal/Makefile.in b/tests/IDom/ITraversal/Makefile.in
new file mode 100644
index 0000000000000000000000000000000000000000..9e35d40a0b8f54f3f0523278f9672ad5d1d080c3
--- /dev/null
+++ b/tests/IDom/ITraversal/Makefile.in
@@ -0,0 +1,116 @@
+#
+# The Apache Software License, Version 1.1
+#
+# Copyright (c) 2001 The Apache Software Foundation.  All rights
+# reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in
+#    the documentation and/or other materials provided with the
+#    distribution.
+#
+# 3. The end-user documentation included with the redistribution,
+#    if any, must include the following acknowledgment:
+#       "This product includes software developed by the
+#        Apache Software Foundation (http://www.apache.org/)."
+#    Alternately, this acknowledgment may appear in the software itself,
+#    if and wherever such third-party acknowledgments normally appear.
+#
+# 4. The names "Xerces" and "Apache Software Foundation" must
+#    not be used to endorse or promote products derived from this
+#    software without prior written permission. For written
+#    permission, please contact apache\@apache.org.
+#
+# 5. Products derived from this software may not be called "Apache",
+#    nor may "Apache" appear in their name, without prior written
+#    permission of the Apache Software Foundation.
+#
+# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+# ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+# ====================================================================
+#
+# This software consists of voluntary contributions made by many
+# individuals on behalf of the Apache Software Foundation, and was
+# originally based on software copyright (c) 2001, International
+# Business Machines, Inc., http://www.ibm.com .  For more information
+# on the Apache Software Foundation, please see
+# <http://www.apache.org/>.
+#
+#
+# $Id$
+#
+#
+
+###################################################################
+#                    IMPORTANT NOTE                               #
+###################################################################
+# If you are going to do the OS390BATCH build, make sure you have #
+# the OS390BATCH environment variable set.                        #
+#                                                                 #
+#   export OS390BATCH=1                                           #
+#                                                                 #
+###################################################################
+
+PLATFORM = @platform@
+COMPILER = @compiler@
+CXXFLAGS = @cxxflags@
+CFLAGS = @cflags@
+PREFIX = @prefix@
+OSVER = @osver@
+LIBS = @libs@
+CC = @compiler@
+
+include ../../../version.incl
+include ../../Makefile.incl
+
+APP_NAME=ITraversal
+APP_DIR=IDOM/ITraversal
+
+OUTDIR= ${XERCESCROOT}/tests/${APP_DIR}
+EXEC=	${XERCESCROOT}/bin
+OBJS=	${OUTDIR}/ITraversal.o
+SRC=	${XERCESCROOT}/tests/${APP_DIR}
+HEADER_FILES=
+INCLUDE = ${INCLUDES}
+
+## OS390BATCH
+ifeq (${OS390BATCH},1)
+BATCH_TARGET= "//'${LOADMOD}(TRAVERSA)'"
+all: makedir ${BATCH_TARGET}
+else
+all: makedir ${EXEC}/${APP_NAME}
+endif
+
+makedir:
+	-mkdir -p $(OUTDIR)
+
+${EXEC}/${APP_NAME}: ${OBJS}
+	${LINK} ${PLATFORM_LIB_LINK_OPTIONS} ${OBJS} -o $@ ${LIBRARY_SEARCH_PATHS} ${LIBRARY_NAMES} ${EXTRA_LINK_OPTIONS}
+${BATCH_TARGET}: ${OBJS}
+	${LINK} ${PLATFORM_LIB_LINK_OPTIONS} ${OBJS} -o $@ ${LIBRARY_SEARCH_PATHS} ${LIBRARY_NAMES} ${EXTRA_LINK_OPTIONS}
+
+$(OUTDIR)/ITraversal.o: ${SRC}/ITraversal.cpp ${HEADER_FILES}
+	${CC} ${CMP} $(INCLUDE) -o $(OUTDIR)/ITraversal.o ${SRC}/ITraversal.cpp
+
+clean:
+	rm -f ${OBJS} ${EXEC}/${APP_NAME}
+
+distclean:	clean
+	rm -f Makefile
diff --git a/tests/Makefile.in b/tests/Makefile.in
index df3692826533c5f4d49b5023b979921c4d298b71..d2eb046e9708be68eb344d592d6fc1bdec099b50 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -61,6 +61,7 @@ DOMIDTest_DIR=DOM/DOMIDTest
 DOMMemTest_DIR=DOM/DOMMemTest
 DOMTest_DIR=DOM/DOMTest
 Traversal_DIR=DOM/Traversal
+ITraversal_DIR=IDOM/ITraversal
 ThreadTest_DIR=ThreadTest
 IThreadTest_DIR=IThreadTest
 EncodingTest_DIR=EncodingTest
@@ -78,12 +79,12 @@ OSVER = @osver@
 
 ifeq (${PLATFORM},HPUX)
   ifeq (${OSVER}, HPUX10)
-      all:	threadtest ithreadtest encodingtest traversal
+      all:	threadtest ithreadtest encodingtest traversal itraversal
   else
-      all:	domtest threadtest ithreadtest encodingtest traversal
+      all:	domtest threadtest ithreadtest encodingtest traversal itraversal
   endif
 else
-    all:	domidtest dommemtest domtest threadtest ithreadtest encodingtest traversal rangetest irangetest
+    all:	domidtest dommemtest domtest threadtest ithreadtest encodingtest traversal itraversal rangetest irangetest
 endif
 
 domidtest:
@@ -114,6 +115,10 @@ traversal:
 	@echo Building "Traversal"
 	cd $(Traversal_DIR) ; $(MAKE) $(MAKE_FLAGS) ; cd ..
 
+itraversal:
+	@echo Building "ITraversal"
+	cd $(ITraversal_DIR) ; $(MAKE) $(MAKE_FLAGS) ; cd ..
+
 rangetest:
 	@echo Building "Range"
 	cd $(DOMRange_DIR) ; $(MAKE) $(MAKE_FLAGS) ; cd ..
@@ -130,6 +135,7 @@ clean:
 	cd $(IThreadTest_DIR) && $(MAKE) $@ && cd ..
 	cd $(EncodingTest_DIR) && $(MAKE) $@ && cd ..
 	cd $(Traversal_DIR) && $(MAKE) $@ && cd ..
+	cd $(ITraversal_DIR) && $(MAKE) $@ && cd ..
 	cd $(DOMRange_DIR) && $(MAKE) $@ && cd ..
 	cd $(IDOMRange_DIR) && $(MAKE) $@ && cd ..
 
@@ -141,6 +147,7 @@ distclean:
 	cd $(IThreadTest_DIR) && $(MAKE) $@ && cd ..
 	cd $(EncodingTest_DIR) && $(MAKE) $@ && cd ..
 	cd $(Traversal_DIR) && $(MAKE) $@ && cd ..
+	cd $(ITraversal_DIR) && $(MAKE) $@ && cd ..
 	cd $(DOMRange_DIR) && $(MAKE) $@ && cd ..
 	cd $(IDOMRange_DIR) && $(MAKE) $@ && cd ..
 	rm -f Makefile config.cache config.log config.status
diff --git a/tests/configure b/tests/configure
index 1e920b5e29163e6ef42b05d09b90f0a4e9b13f11..4ae008f820b55a096802ebde8f72eef7b27ee35b 100755
--- a/tests/configure
+++ b/tests/configure
@@ -1451,6 +1451,7 @@ DOM/DOMTest/Makefile \
 DOM/DOMIDTest/Makefile \
 DOM/DOMMemTest/Makefile \
 DOM/Traversal/Makefile \
+IDOM/ITraversal/Makefile \
 EncodingTest/Makefile \
 DOM/RangeTest/Makefile \
 IDOM/IRangeTest/Makefile \
@@ -1552,6 +1553,7 @@ DOM/DOMTest/Makefile \
 DOM/DOMIDTest/Makefile \
 DOM/DOMMemTest/Makefile \
 DOM/Traversal/Makefile \
+IDOM/ITraversal/Makefile \
 EncodingTest/Makefile \
 DOM/RangeTest/Makefile \
 IDOM/IRangeTest/Makefile \
diff --git a/tests/configure.in b/tests/configure.in
index 60fcd6809fcd69112320217f6a66141ab0ff5534..2c56ce8cb9d8beeed62fb3ce73e264c9ce519b26 100644
--- a/tests/configure.in
+++ b/tests/configure.in
@@ -73,6 +73,7 @@ DOM/DOMTest/Makefile \
 DOM/DOMIDTest/Makefile \
 DOM/DOMMemTest/Makefile \
 DOM/Traversal/Makefile \
+IDOM/ITraversal/Makefile \
 EncodingTest/Makefile \
 DOM/RangeTest/Makefile \
 IDOM/IRangeTest/Makefile \