You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by tn...@apache.org on 2001/11/23 21:44:10 UTC

cvs commit: xml-xerces/c/tests/DOM/DOMTest DTest.cpp

tng         01/11/23 12:44:10

  Modified:    c/tests/DOM/DOMTest DTest.cpp
  Log:
  Solaris Forte C++ core dump when handling this long condition check; so break it into smaller check to bypass this compiler problem.
  
  Revision  Changes    Path
  1.14      +190 -184  xml-xerces/c/tests/DOM/DOMTest/DTest.cpp
  
  Index: DTest.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/tests/DOM/DOMTest/DTest.cpp,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- DTest.cpp	2000/08/30 22:21:44	1.13
  +++ DTest.cpp	2001/11/23 20:44:10	1.14
  @@ -1,37 +1,37 @@
   /*
    * The Apache Software License, Version 1.1
  - * 
  + *
    * Copyright (c) 1999-2000 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. 
  - * 
  + *    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:  
  + *    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 
  + *    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
  @@ -45,7 +45,7 @@
    * 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) 1999, International
  @@ -56,6 +56,9 @@
   
   /*
    * $Log: DTest.cpp,v $
  + * Revision 1.14  2001/11/23 20:44:10  tng
  + * Solaris Forte C++ core dump when handling this long condition check; so break it into smaller check to bypass this compiler problem.
  + *
    * Revision 1.13  2000/08/30 22:21:44  andyh
    * Unix Build script fixes.  Clean up some UNIX compiler warnings.
    *
  @@ -115,11 +118,11 @@
   /**
    * This class tests methods for XML DOM implementation
    * version 2.0 10/12/98
  - * 
  + *
    * DOM_DOMException errors are tested by calls to DOMExceptionsTest from: Main, docBuilder...
    *
    */
  - 
  +
   #include <stdio.h>
   #include "DTest.h"
   #include <util/PlatformUtils.hpp>
  @@ -148,7 +151,7 @@
                   testNum);                                           \
               resultFlag = false;                                     \
           }                                                           \
  -    }  
  +    }
   
   
   #define LEAKTEST(operation)                             \
  @@ -183,11 +186,11 @@
   DOM_Notation                DTest::testNotationNode;
   
   /**
  - * 
  + *
    * version 2.0 10/12/98
    *
    */
  -    
  +
   DTest::DTest()
   {
   };
  @@ -195,7 +198,7 @@
   
   /**
    * version 3.0 01/25/99
  - *  
  + *
    * @return DOM_Document
    *
    */
  @@ -206,7 +209,7 @@
   
   /**
    * version 3.0 01/25/99
  - * 
  + *
    * @return DOM_DocumentType
    * @param name DOMString
    *
  @@ -218,7 +221,7 @@
   
   /**
    * version 3.0 01/25/99
  - *  
  + *
    * @return org.w3c.dom.DOM_Entity
    * @param doc org.w3c.dom.DOM_Document
    * @param name DOMString
  @@ -232,7 +235,7 @@
   
   /**
    * version 3.0 01/25/99
  - * 
  + *
    * @return org.w3c.dom.DOM_Notation
    * @param doc org.w3c.dom.DOM_Document
    * @param name DOMString
  @@ -255,18 +258,18 @@
   {
       DOM_Document doc = document;
       bool OK = true;
  -        
  +
       DOM_Element docFirstElement = doc.createElement(name + "FirstElement");
       doc.appendChild(docFirstElement);
       docFirstElement.setAttribute(name + "FirstElement", name + "firstElement");
  -    
  +
       DOM_ProcessingInstruction docProcessingInstruction = doc.createProcessingInstruction(name +
                       "TargetProcessorChannel", DOMString("This is ") + doc.getNodeName() + "'s processing instruction");
       docFirstElement.appendChild(docProcessingInstruction);
  -    
  +
       DOM_Element docBody = doc.createElement(name + "TestBody");
       docFirstElement.appendChild(docBody);
  -    
  +
       DOM_Element docBodyLevel21 = doc.createElement(name + "BodyLevel21");
       DOM_Element docBodyLevel22 = doc.createElement(name + "BodyLevel22");
       DOM_Element docBodyLevel23 = doc.createElement(name + "BodyLevel23");
  @@ -275,7 +278,7 @@
       docBody.appendChild(docBodyLevel22);
       docBody.appendChild(docBodyLevel23);
       docBody.appendChild(docBodyLevel24);
  -    
  +
       DOM_Element docBodyLevel31 = doc.createElement(name + "BodyLevel31");
       DOM_Element docBodyLevel32 = doc.createElement(name + "BodyLevel32");
       DOM_Element docBodyLevel33 = doc.createElement(name + "BodyLevel33");
  @@ -284,7 +287,7 @@
       docBodyLevel21.appendChild(docBodyLevel32);
       docBodyLevel22.appendChild(docBodyLevel33);
       docBodyLevel22.appendChild(docBodyLevel34);
  -    
  +
       DOM_Text docTextNode11 = doc.createTextNode(name + "BodyLevel31'sChildTextNode11");
       DOM_Text docTextNode12 = doc.createTextNode(name + "BodyLevel31'sChildTextNode12");
       DOM_Text docTextNode13 = doc.createTextNode(name + "BodyLevel31'sChildTextNode13");
  @@ -297,13 +300,13 @@
       docBodyLevel32.appendChild(docTextNode2);
       docBodyLevel33.appendChild(docTextNode3);
       docBodyLevel34.appendChild(docTextNode4);
  -    
  +
       DOM_CDATASection docCDATASection = doc.createCDATASection("<![CDATA[<greeting>Hello, world!</greeting>]]>");
       docBodyLevel23.appendChild(docCDATASection);
  -    
  +
       DOM_Comment docComment = doc.createComment("This should be a comment of some kind ");
       docBodyLevel23.appendChild(docComment);
  -    
  +
       DOM_EntityReference docReferenceEntity = doc.createEntityReference("ourEntityNode");
       docBodyLevel24.appendChild(docReferenceEntity);
   
  @@ -312,16 +315,16 @@
       DOM_Node abc1 = doc.getFirstChild();
       DOM_DocumentType docType = (DOM_DocumentType &) abc1;
       docType.getNotations().setNamedItem(docNotation);
  -    
  +
       DOM_DocumentFragment docDocFragment = doc.createDocumentFragment();
  -    
  +
   //  printf("This document's first element name is " + docFirstElement.getTagName() + "\n");
   
   
   //***********Following are for errorTests
       DOM_Text docNode3 = doc.createTextNode(name + "docTextNode3");
       DOM_Text docNode4 = doc.createTextNode(name + "docTextNode4");
  -    
  +
       DOM_Node  abc2 =  doc.getDoctype().getEntities().getNamedItem("ourEntityNode"); // Get the DOM_Entity node
       DOM_Entity docEntity = (DOM_Entity &) abc2;
       DOM_Node  abc3 = doc.getFirstChild(); // Get the DOM_DocumentType node
  @@ -335,10 +338,10 @@
       EXCEPTIONSTEST(document.appendChild(docBody), DOM_DOMException::HIERARCHY_REQUEST_ERR, OK,  1);
   
       EXCEPTIONSTEST(document.appendChild(docBody), DOM_DOMException::HIERARCHY_REQUEST_ERR, OK, 2);
  -    EXCEPTIONSTEST(docNode3.appendChild(docNode4), DOM_DOMException::HIERARCHY_REQUEST_ERR, OK, 3); 
  -    // EXCEPTIONSTEST(doc.insertBefore(docEntity, docFirstElement), DOM_DOMException::HIERARCHY_REQUEST_ERR, OK, 4); 
  -    EXCEPTIONSTEST(doc.replaceChild(docCDATASection, docFirstElement), DOM_DOMException::HIERARCHY_REQUEST_ERR, OK, 5); 
  -    EXCEPTIONSTEST(docFirstElement.setNodeValue("This shouldn't work!" ), DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR, OK, 6);    
  +    EXCEPTIONSTEST(docNode3.appendChild(docNode4), DOM_DOMException::HIERARCHY_REQUEST_ERR, OK, 3);
  +    // EXCEPTIONSTEST(doc.insertBefore(docEntity, docFirstElement), DOM_DOMException::HIERARCHY_REQUEST_ERR, OK, 4);
  +    EXCEPTIONSTEST(doc.replaceChild(docCDATASection, docFirstElement), DOM_DOMException::HIERARCHY_REQUEST_ERR, OK, 5);
  +    EXCEPTIONSTEST(docFirstElement.setNodeValue("This shouldn't work!" ), DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR, OK, 6);
       EXCEPTIONSTEST(docReferenceEntity.setNodeValue("This shouldn't work!" ), DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR, OK, 7);
       // EXCEPTIONSTEST(docEntity.setNodeValue("This shouldn't work!" ), DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR, OK, 8);
       EXCEPTIONSTEST(doc.setNodeValue("This shouldn't work!" ), DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR, OK, 9);
  @@ -352,9 +355,9 @@
   
   
   //!! Throws a NOT_FOUND_ERR ********
  -     
  +
        // docBodyLevel32.getAttributes().removeNamedItem(testAttribute.getName());    16  // To test removeNamedItem
  -     
  +
   };  //END OF DOCBUILDER
   
   
  @@ -423,22 +426,22 @@
       DTest test;
       DOM_Node kid;
       // Walk the tree until you find and assign all node types needed that exist.
  -    
  -        
  +
  +
       if (node.getFirstChild() != null)
       {
           kid = node.getFirstChild();
           test.findTestNodes(kid);
       }
  -            
  -                
  +
  +
       if (node.getNextSibling() != null)
       {
           kid = node.getNextSibling();
           test.findTestNodes(kid);
       }
   
  -        
  +
       switch (node.getNodeType())
       {
           case DOM_Node::ELEMENT_NODE :
  @@ -483,18 +486,18 @@
   };//End of class
   
   /**
  - * 
  + *
    * version 2.0 10/12/98
    *
    */
    int main(int argc, char **argv)
    {
  -     
  +
        {
            //  Nest entire test in an inner block.
            //     Reference counting should recover all document
            //     storage when this block exits.
  -         
  +
            DTest test;
            try {
                XMLPlatformUtils::Initialize();
  @@ -504,32 +507,32 @@
                fprintf(stderr, "Error during initialization! \n  %s \n", pMessage);
                delete [] pMessage;
                return -1;
  -         } 
  -         
  +         }
  +
            long avgTime = 0;
            bool OK = true;
            long startTime = 0;//****************Time the whole thing for efficiency of DOM implementation
  -         
  +
            // for (int i=0; i< 1000; i++)
  -         // {   
  +         // {
            // AH Revisit  //  startTime = System.currentTimeMillis();
            //     if(!OK)
            //     break;
  -         
  +
            DOM_Document d = test.createDocument();
            // DOM_Document z = test.createDocument();
  -         
  +
            DOM_DocumentType docDocType = test.createDocumentType(d,"testDocument1");
            d.appendChild(docDocType);
  -         
  +
            DOM_Entity docEntity = test.createEntity( d, "ourEntityNode");
            //Build a branch for entityReference tests
  -         // DOM_Text entityChildText = d.createTextNode("entityChildText information"); // 
  -         // docEntity.appendChild(entityChildText);                    
  +         // DOM_Text entityChildText = d.createTextNode("entityChildText information"); //
  +         // docEntity.appendChild(entityChildText);
            // docDocType.getEntities().setNamedItem(docEntity);
  -         
  +
            test.docBuilder(d, "d");
  -         
  +
            test.findTestNodes((DOM_Node)d);
            // test.docBuilder(z, "z");
            // try {
  @@ -541,70 +544,70 @@
            LEAKTEST(test.testDeepNodeList(d););
            LEAKTEST(test.testDocument(d););
            LEAKTEST(test.testDocumentFragment(d););
  -         LEAKTEST(test.testDocumentType(d);); 
  +         LEAKTEST(test.testDocumentType(d););
            LEAKTEST(test.testDOMImplementation(d););
            LEAKTEST(test.testElement(d););
   //       LEAKTEST(test.testEntity(d););      // Can not test entities;  only parser can create them.
            LEAKTEST(test.testEntityReference(d););
            LEAKTEST(test.testNode(d););
  -         LEAKTEST(test.testNotation(d););  
  -         LEAKTEST(test.testPI(d);); 
  -         LEAKTEST(test.testText(d););  
  +         LEAKTEST(test.testNotation(d););
  +         LEAKTEST(test.testPI(d););
  +         LEAKTEST(test.testText(d););
            LEAKTEST(test.testDOMerrors(d););
  -         
  +
            //!! Throws WRONG_DOCUMENT_ERR **********
  -         
  +
            // z.appendChild(d.createComment("Test doc d comment"));// Tries to append z document with document d comment
            // d.getDocumentElement().appendChild(z.createElement("newZdocElement"));// Tries to append d document with document z DOM_Element
            // d.getLastChild().getLastChild().insertBefore(z.createElement("newZdocElement"),d.getLastChild().getLastChild().getFirstChild());// Tries to insert into d document with document z DOM_Element
            // d.replaceChild(z.createElement("newZdocElement"),d.getLastChild().getLastChild().getFirstChild());  // Tries to replace in d document with document z DOM_Element
  -         
  +
            /* Attribute newAttribute = d.createAttribute("newAttribute");
            d.getDocumentElement().setAttributeNode(newAttribute);
            d.getDocumentElement().getAttributes().setNamedItem(z.createAttribute("newzAttribute"));
            */
  -         
  +
            //!! Throws INVALID_CHARACTER_ERR **********
            // ******This just gets us through each method. JKess has a comprehensive test of Invalid Names******
            // d.createAttribute("Invalid Name"); // Name with blank space
            // d.createElement("5InvalidName"); // Name starts with numeric
            // d.createProcessingInstruction("This is the target processor channel","InvalidName>");// Name ends with >
            // d.getDocumentElement().setAttribute("Invalid%Name",""); // Name contains %
  -         
  -         
  +
  +
            //!!   ******** NO_DATA_ALLOWED_ERR ********No cases to test as of 9/15
  -         
  -         
  +
  +
            //!!   ******** NO_MODIFICATION_ALLOWED_ERR ******** When read only exists
            /*
  -         
  -           
  -             
  +
  +
  +
                  // **** FOR DOM_Element when read only exists********
                  .removeAttribute("aString");        // ***** Not until read only exists.
                  .removeAttributeNode(Attribute);        // ***** Not until read only exists.
                  .setAttribute("aString", "anotherString"); // ***** Not until read only exists.
  -               
  -                 
  +
  +
                      // **** FOR DOM_Node when read only exists********
                      .appendChild(aNode);         // ***** Not until read only exists.
                      .insertBefore(aNode, AnotherNode);   // ***** Not until read only exists.
                      .removeChild(aNode);         // ***** Not until read only exists.
                      .replaceChild(aNode);            // ***** Not until read only exists.
  -                   
  +
                        .splitText(2); // ***** Not until read only exists.
  -                     
  +
                          .setNamedItem(DOM_Node); // ***** Not until read only exists.
            */
  -         
  -         
  +
  +
            //!!******** NOT_SUPPORTED_ERR ********For HTML when implemented
            /*
            .createCDATASection("String stuff");
            .createEntityReference("String stuff");
            .createProcessingInstruction("String stuff", "Some more String stuff");
            */
  -         
  +
            // } catch (DOM_DOMException &e) {
            //     fprintf(stderr, "Unexpected DOM Exception caught.  Code is: %d\n", e.code);
            //     OK = false;
  @@ -612,19 +615,19 @@
            //    catch (...) {
            //        fprintf(stderr, "Unexpected non-DOM exception caught.");
            //    };
  -         
  -         
  +
  +
            //System.err.println("Elapsed time (measured in seconds): " +   ((System.currentTimeMillis() - startTime) / 1000.0));
            // AH revisit avgTime += System.currentTimeMillis() - startTime;
            // }//END OF FOR
  -         
  -         
  +
  +
            // System.err.println("Elapsed time (measured in seconds): " +
            //                    ((System.currentTimeMillis() - startTime) / 1000.0));
            //       System.err.println("Elapsed time (measured in mili-seconds): " +
            //                    ((System.currentTimeMillis() - startTime)));
  -         
  -         
  +
  +
            // System.err.println("Average Elapsed time (measured in seconds): " + (avgTime/10000000.0) );
   
            // Null out the static object references in class DTest,
  @@ -641,7 +644,7 @@
            DTest::testDocumentTypeNode = null;
            DTest::testDocumentFragmentNode = null;
            DTest::testNotationNode = null;
  -         
  +
       };
   
       XMLPlatformUtils::Terminate();
  @@ -658,7 +661,7 @@
    */
   void DTest::testAttr(DOM_Document document)
   {
  -    DOM_Node node;  
  +    DOM_Node node;
       DOM_Attr attributeNode, attribute2;
       DOMString compare;
       bool T = true;
  @@ -673,9 +676,9 @@
       // ((DOM_Element &)node).setAttributeNode(testAttribute);
       // attributeNode = ((DOM_Element &)node).getAttributeNode("testAttribute");
       DOM_Element el = (DOM_Element &)node;
  -    el.setAttributeNode(testAttribute); 
  +    el.setAttributeNode(testAttribute);
       attributeNode = el.getAttributeNode("testAttribute");
  -    
  +
       compare = "testAttribute";
       if (!compare.equals(attributeNode.getName()))
       {
  @@ -693,7 +696,7 @@
           printf("Warning!!! DOM_Attr's 'getSpecified' method failed to work properly!\n");
           OK = false;
       }
  -    
  +
       if (!compare.equals(attributeNode.getValue()))
       {
           printf("Warning!!! DOM_Attr's 'getValue' method failed to work properly!\n");
  @@ -715,7 +718,7 @@
           printf("Warning!!! DOM_Attr's 'setValue' to 'null' method failed to work properly!\n");
           OK = false;
       }
  -    
  +
       attributeNode.setValue("Another value ");
       compare = "Another value ";
       if (!compare.equals(attributeNode.getValue()))
  @@ -725,7 +728,7 @@
       }
   
       node = attributeNode.cloneNode(T);
  -                                      
  +
       // Check nodes for equality, both their name and value or lack thereof
       bool cloneOK = true;
       if (!(node.getNodeName().equals(attributeNode.getNodeName())))
  @@ -757,7 +760,7 @@
           : (node.getNodeValue() == null && attributeNode.getNodeValue() == null)))// If one node doesn't have a value node make sure both don't
   */
       if (cloneOK == false)
  -        {   
  +        {
               printf("'cloneNode' did not clone the Attribute node correctly\n");
               OK = false;
           }
  @@ -765,7 +768,7 @@
   
   //************************************************* ERROR TESTS
       DTest tests;
  -//!! Throws HIERARCHY_REQUEST_ERR ****************  
  +//!! Throws HIERARCHY_REQUEST_ERR ****************
       //  doc.getDocumentElement().appendChild(attributeNode);
   
   //!! Throws a NOT_FOUND_ERR ********
  @@ -775,7 +778,7 @@
   //!! Throws an INUSE_ATTRIBUTE_ERR ******
       //  DOM_Element element = (DOM_Element &)doc.getLastChild().getLastChild();
       //  element.setAttributeNode(testAttribute );// Tests setNamedItem which generates error through justSetNamedItem.
  -    
  +
   // For debugging*****       printf("All DOM_Attr method calls worked correctly.\n");
       if (! OK)
           printf("\n*****The DOM_Attr method calls listed above failed, all others worked correctly.*****\n");
  @@ -811,9 +814,9 @@
           OK = false;
       }
       // Deep clone test comparison is in testNode & testDocument
  -    
  +
   // For debugging*****   printf("All DOM_CDATASection method calls worked correctly.\n");
  -        
  +
       if (! OK)
           printf("\n*****The DOM_CDATASection method calls listed above failed, all others worked correctly.*****\n");
   //  printf("");
  @@ -840,8 +843,8 @@
       {
           printf("Warning!!! DOM_CharacterData's 'getData' failed to work properly!\n This may corrupt other DOM_CharacterData tests!!!*****\n");
           OK = false;
  -    }   
  -    
  +    }
  +
       resetData = charData.getData();
       //  printf("This node's original data is: " + charData.getData());
   
  @@ -926,20 +929,20 @@
       EXCEPTIONSTEST(charData.deleteData(100, 5), DOM_DOMException::INDEX_SIZE_ERR, OK,103 );
   
   //can't set negative unsigned int in c++ compiler
  -    
  +
     //  EXCEPTIONSTEST(charData.insertData(-1, "Stuff inserted"), DOM_DOMException::INDEX_SIZE_ERR, OK, 104 );
       EXCEPTIONSTEST(charData.insertData(100,"Stuff inserted"), DOM_DOMException::INDEX_SIZE_ERR, OK, 105 );
  -    
  +
     //  EXCEPTIONSTEST(charData.replaceData(-1, 5, "Replacement stuff") , DOM_DOMException::INDEX_SIZE_ERR, OK, 106 );
       EXCEPTIONSTEST(charData.replaceData(100, 5 ,"Replacement stuff"), DOM_DOMException::INDEX_SIZE_ERR, OK, 107 );
     //  EXCEPTIONSTEST(charData.replaceData(2, -1, "Replacement stuff"), DOM_DOMException::INDEX_SIZE_ERR,  OK, 108 );
  -    
  +
       EXCEPTIONSTEST(charData.substringData(-1, 5), DOM_DOMException::INDEX_SIZE_ERR, OK, 109 );
       EXCEPTIONSTEST(charData.substringData(100, 5), DOM_DOMException::INDEX_SIZE_ERR, OK, 110 );
    //   EXCEPTIONSTEST(charData.substringData(2, -1), DOM_DOMException::INDEX_SIZE_ERR, OK, 111 );
  -    
   
  -//!! Throws NO_MODIFICATION_ALLOWED_ERR ******** 
  +
  +//!! Throws NO_MODIFICATION_ALLOWED_ERR ********
   // Since user cannot add children to Entity and EntityReference Nodes this test can't be done.
   #if 0
   
  @@ -954,7 +957,7 @@
       EXCEPTIONSTEST(node.setData("New setdata stuff"), DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR, OK, 116 );
   
   #endif
  -        
  +
   // For debugging*****       printf("All DOM_CharacterData method calls worked correctly.\n");
       if (!OK)
           printf("\n*****The DOM_CharacterData method calls listed above failed, all others worked correctly.*****\n");
  @@ -965,7 +968,7 @@
   
   
   
  -/** 
  +/**
    * This method tests ChildNodeList methods for the XML DOM implementation
    * version 2.0 10/12/98
    * @param document org.w3c.dom.DOM_Document
  @@ -977,16 +980,16 @@
       bool OK = true;
   // For debugging*****   printf("\n          testChildNodeList's outputs:\n");
       node = document.getDocumentElement().getLastChild(); // node gets doc's testBody element
  -    
  +
       if (!(node.getChildNodes().getLength()== 4))
           OK = false;
       node2 = node.getChildNodes().item(2);
       if (! node2.getNodeName().equals("dBodyLevel23"))
           OK = false;
  -    
  +
   // For debugging*****       printf("All ChildNodeList method calls worked correctly.\n");
       if (!OK)
  -        printf("\n*****The ChildNodeList method calls listed above failed, all others worked correctly.*****\n");       
  +        printf("\n*****The ChildNodeList method calls listed above failed, all others worked correctly.*****\n");
   //  printf("");
   };
   
  @@ -1042,22 +1045,22 @@
     if (!(8 == ((DOM_Element &) node).getElementsByTagName("*").getLength()))
           {
               printf ("Warning!!! DeepNodeList's 'getLength' failed to work properly!\n");
  -            OK = false;     
  +            OK = false;
           }
       node2 = ((DOM_Element &) node).getElementsByTagName("*").item(2); //This also runs through 'nextMatchingElementAfter"
       if (! node2.getNodeName().equals("dBodyLevel32"))
           {
               printf ("Warning!!! DeepNodeList's 'item' (or DOM_Element's 'getElementsBy TagName)failed to work properly!\n");
  -            OK = false;     
  +            OK = false;
           }
       node2 = document.getLastChild();
       if (! ((DOM_Element &) node2).getElementsByTagName("dTestBody").item(0).getNodeName().equals("dTestBody"))//This also runs through 'nextMatchingElementAfter"
           {
               printf ("Warning!!! DeepNodeList's 'item' (or DOM_Element's 'getElementsBy TagName)failed to work properly!\n");
  -            OK = false;     
  +            OK = false;
           }
  -        
  -    
  +
  +
   // For debugging*****       printf("All DeepNodeList method calls worked correctly.\n");
       if (!OK)
           printf("\n*****The DeepNodeList method calls listed above failed, all others worked correctly.*****\n");
  @@ -1086,7 +1089,7 @@
       bool result;
       bool OK = true;
   // For debugging*****   printf("\n          testDocument's outputs:\n \n");
  -    
  +
       DOM_DocumentType checkDocType =  make.createDocumentType(document,"testDocument1");
       DOM_DocumentType docType = document.getDoctype();
   
  @@ -1112,17 +1115,19 @@
           OK = false;
       }
       */
  -        
  +
       DOM_Node rootElement = document.getLastChild();
  -    if (! (rootElement.getNodeName().equals(document.getDocumentElement().getNodeName()) &&         // Compares node names for equality
  -          (rootElement.getNodeValue() != null && document.getDocumentElement().getNodeValue() != null)   // Checks to make sure each node has a value node
  +
  +    bool check = (rootElement.getNodeValue() != null && document.getDocumentElement().getNodeValue() != null)   // Checks to make sure each node has a value node
           ?  rootElement.getNodeValue().equals(document.getDocumentElement().getNodeValue())      // If both have value nodes test those value nodes for equality
  -        : (rootElement.getNodeValue() == null && document.getDocumentElement().getNodeValue() == null)))    // If one node doesn't have a value node make sure both don't
  +        : (rootElement.getNodeValue() == null && document.getDocumentElement().getNodeValue() == null);    // If one node doesn't have a value node make sure both don't
  +    if (! (rootElement.getNodeName().equals(document.getDocumentElement().getNodeName()) &&        // Compares node names for equality
  +         check))
       {
           printf("Warning!!! DOM_Document's 'getDocumentElement' method failed!\n" );
           OK = false;
       }
  -    
  +
       DOM_NodeList docElements = document.getElementsByTagName("*");
       int docSize = docElements.getLength();
       int i;
  @@ -1131,7 +1136,7 @@
           DOM_Node n = (DOM_Node) docElements.item(i);
           if (! (elementNames[i].equals(n.getNodeName())))
           {
  -            printf("Comparison of this document's elements failed at element number %d : ", i); 
  +            printf("Comparison of this document's elements failed at element number %d : ", i);
               n.getNodeName().print();
               OK = false;
               break;
  @@ -1143,11 +1148,11 @@
       //if (document.equals(document.getImplementation()))
       //{
       //  printf("Warning!!! DOM_Document's 'getImplementation' method failed!\n" );
  -    //  OK = false;     
  +    //  OK = false;
       //}
  -        
  +
       newElement = document.createElement("NewElementTestsInsertBefore");
  -    //  doc.insertBefore(newElement,null);//!! Throws a HIERARCHY_REQUEST_ERR   ******* 
  +    //  doc.insertBefore(newElement,null);//!! Throws a HIERARCHY_REQUEST_ERR   *******
       //  doc.removeChild(docElements.item(9));//!! Throws a NOT_FOUND_ERR  ********
   
       docFragment = document.createDocumentFragment();
  @@ -1169,7 +1174,7 @@
           }
       }
       docElements.item(1).insertBefore(docFragment, DOM_Node()); //Reattaches removed branch to restore tree to the original
  -                                                // AH Revist.  Note: insertBefore should be able to take 
  +                                                // AH Revist.  Note: insertBefore should be able to take
                                                   //   a null as its second parameter.
       docElements.item(1).insertBefore(docFragment2, docElements.item(2)); //Reattaches removed branch to restore tree to the original
   
  @@ -1190,19 +1195,19 @@
   
       DTest tests;
   
  -    
  +
   //  DOM_Document z = tests.createDocument();
   //  tests.docBuilder(z, "z");
   
   //!! Throws WRONG_DOCUMENT_ERR **********
  -//  EXCEPTIONSTEST(z.appendChild(       
  +//  EXCEPTIONSTEST(z.appendChild(
       //  z.appendChild(d.createComment("Test doc d comment"));// Tries to append z document with document d comment
       //  d.getDocumentElement().appendChild(z.createElement("newZdocElement"));// Tries to append d document with document z DOM_Element
       //  d.getLastChild().getLastChild().insertBefore(z.createElement("newZdocElement"),d.getLastChild().getLastChild().getFirstChild());// Tries to insert into d document with document z DOM_Element
       //  d.replaceChild(z.createElement("newZdocElement"),d.getLastChild().getLastChild().getFirstChild());  // Tries to replace in d document with document z DOM_Element
   
       //  doc.setNodeValue("This shouldn't work");//!! Throws a NO_MODIFICATION_ALLOWED_ERR ********
  -    
  +
       node = document;
       node2 = document.cloneNode(true);
       result = treeCompare(node, node2); // Deep clone test comparison of document cloneNode
  @@ -1213,8 +1218,8 @@
       }
   
       // Deep clone test comparison is also in testNode
  -    
  -    
  +
  +
   // For debugging*****       printf("All DOM_Document method calls worked correctly.\n");
       if (!OK)
           printf("\n*****The DOM_Document method calls listed above failed, all others worked correctly.*****\n");
  @@ -1237,9 +1242,9 @@
       bool OK = true;
   // For debugging*****   printf("\n          testDocumentFragment's outputs:\n");
       DOM_DocumentFragment testDocFragment = document.createDocumentFragment();
  -        
  +
       //  testDocFragment.setNodeValue("This is a document fragment!");//!! Throws a NO_MODIFICATION_ALLOWED_ERR ********
  -    
  +
   // For debugging*****       printf("All DOM_DocumentFragment method calls worked correctly.\n");
       if (!OK)
           printf("\n*****The DOM_DocumentFragment method calls listed above failed, all others worked correctly.*****\n");
  @@ -1267,11 +1272,12 @@
       node = document.getFirstChild(); // node gets doc's docType node
       node2 = node.cloneNode(true);
       // Check nodes for equality, both their name and value or lack thereof
  -    if (! (node.getNodeName().equals(node2.getNodeName()) &&         // Compares node names for equality
  -          (node.getNodeValue() != null && node2.getNodeValue() != null)  // Checks to make sure each node has a value node
  +    bool check = (node.getNodeValue() != null && node2.getNodeValue() != null)  // Checks to make sure each node has a value node
           ?  node.getNodeValue().equals(node2.getNodeValue())          // If both have value nodes test those value nodes for equality
  -        : (node.getNodeValue() == null && node2.getNodeValue() == null)))// If one node doesn't have a value node make sure both don't
  -    {   
  +        : (node.getNodeValue() == null && node2.getNodeValue() == null);// If one node doesn't have a value node make sure both don't
  +    if (! (node.getNodeName().equals(node2.getNodeName()) &&         // Compares node names for equality
  +          check))
  +    {
           printf("'cloneNode' did not clone the DOM_DocumentType node correctly\n");
           OK = false;
       }
  @@ -1289,7 +1295,7 @@
           printf("Warning!!! DOM_DocumentType's 'getEntities' failed!\n" );
           OK = false;
       }
  -#endif 
  +#endif
   
       docNotationMap = docType.getNotations();
       compare = "ourNotationNode";
  @@ -1298,7 +1304,7 @@
           printf("Warning!!! DOM_DocumentType's 'getNotations' failed!\n");
           OK = false;
       }
  -    //  doc.appendChild(newDocumentTypeImpl);//!! Throws a HIERARCHY_REQUEST_ERR    ******* 
  +    //  doc.appendChild(newDocumentTypeImpl);//!! Throws a HIERARCHY_REQUEST_ERR    *******
       DOM_Node abc10 = document.removeChild(document.getFirstChild()); //Tests removeChild and stores removed branch for tree reconstruction
       holdDocType = (DOM_DocumentType &) abc10;
       document.insertBefore(newDocumentType, document.getDocumentElement());
  @@ -1306,8 +1312,8 @@
   
       document.removeChild(document.getFirstChild()); //Removes newDocumentType for tree restoral
       document.insertBefore(holdDocType, document.getFirstChild()); //Reattaches removed branch to restore tree to the original
  +
   
  -    
   // For debugging*****       printf("All DOM_DocumentType method calls worked correctly.\n");
       if (!OK)
           printf("\n*****The DOM_DocumentType method calls listed above failed, all others worked correctly.*****\n");
  @@ -1324,19 +1330,19 @@
   
       DTest tests;
   
  -    EXCEPTIONSTEST(document.appendChild(testElementNode), DOM_DOMException::HIERARCHY_REQUEST_ERR, OK, 201 ); 
  -    EXCEPTIONSTEST(testTextNode.appendChild(testTextNode), DOM_DOMException::HIERARCHY_REQUEST_ERR, OK, 202 ); 
  +    EXCEPTIONSTEST(document.appendChild(testElementNode), DOM_DOMException::HIERARCHY_REQUEST_ERR, OK, 201 );
  +    EXCEPTIONSTEST(testTextNode.appendChild(testTextNode), DOM_DOMException::HIERARCHY_REQUEST_ERR, OK, 202 );
   #ifdef skipthese
       EXCEPTIONSTEST(document.insertBefore(document.getElementsByTagName("docEntity").item(0),
  -        document.getElementsByTagName("docFirstElement").item(0)), DOM_DOMException::HIERARCHY_REQUEST_ERR, OK, 203 ); 
  +        document.getElementsByTagName("docFirstElement").item(0)), DOM_DOMException::HIERARCHY_REQUEST_ERR, OK, 203 );
       EXCEPTIONSTEST(document.replaceChild(document.getElementsByTagName("docCDATASection").item(0),
  -        document.getElementsByTagName("docFirstElement").item(0)), DOM_DOMException::HIERARCHY_REQUEST_ERR, OK, 204 ); 
  +        document.getElementsByTagName("docFirstElement").item(0)), DOM_DOMException::HIERARCHY_REQUEST_ERR, OK, 204 );
   
       EXCEPTIONSTEST(document.getElementsByTagName("docFirstElement").item(0).setNodeValue("This shouldn't work!" ),
  -            DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR, OK, 205 );   
  +            DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR, OK, 205 );
       EXCEPTIONSTEST(docReferenceEntity.setNodeValue("This shouldn't work!"),
           DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR, OK, 206 );
  -    EXCEPTIONSTEST(docEntity.setNodeValue("This shouldn't work!"), 
  +    EXCEPTIONSTEST(docEntity.setNodeValue("This shouldn't work!"),
           DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR, OK, 207 );
       EXCEPTIONSTEST(document.setNodeValue("This shouldn't work!"),
           DOM_DOMException::NO_MODIFICATION_ALLOWED_ERR, OK, 208 );
  @@ -1357,9 +1363,9 @@
   #endif
   
   //!! Throws a NOT_FOUND_ERR ********
  -     
  +
        // docBodyLevel32.getAttributes().removeNamedItem(testAttribute.getName());    16  // To test removeNamedItem
  -     
  +
   };
   
   
  @@ -1372,12 +1378,12 @@
    */
   void DTest::testDOMImplementation(DOM_Document document)
   {
  -    
  +
       DOM_DOMImplementation implementation;
       bool result = false;
       bool OK = true;
   // For debugging*****   printf("\n          testDOMImplementation's outputs:\n");
  -    implementation = document.getImplementation(); //Uses getDOMImplementation to obtain implementation 
  +    implementation = document.getImplementation(); //Uses getDOMImplementation to obtain implementation
   
       result = implementation.hasFeature("XML", "1.0");
       if(!result)
  @@ -1385,15 +1391,15 @@
           fprintf(stderr, "Warning!!! DOM_DOMImplementation's 'hasFeature' that should be 'true' failed!");
           OK = false;
       }
  -    
  +
       result = implementation.hasFeature("HTML", "4.0");
       if(result)
       {
           fprintf(stderr, "Warning!!! DOM_DOMImplementation's 'hasFeature' that should be 'false' failed!");
           OK = false;
       }
  -    
  -    
  +
  +
   // For debugging*****       printf("All DOM_DOMImplementation method calls worked correctly.\n");
       if (!OK)
           fprintf(stderr, "\n*****The DOM_DOMImplementation method calls listed above failed, all others worked correctly.*****\n");
  @@ -1430,7 +1436,7 @@
            (node.getNodeValue() != null && node2.getNodeValue() != null)  // Checks to make sure each node has a value node
           ? node.getNodeValue().equals(node2.getNodeValue())          // If both have value nodes test those value nodes for equality
           :(node.getNodeValue() == null && node2.getNodeValue() == null)))// If one node doesn't have a value node make sure both don't
  -    {   
  +    {
           fprintf(stderr, "'cloneNode' did not clone the DOM_Element node correctly.\n");
           OK = false;
       }
  @@ -1444,14 +1450,14 @@
           fprintf(stderr, "Warning!!! DOM_Element's 'getAttribute' failed!\n");
           OK = false;
       }
  -    
  +
       attributeNode = element.getAttributeNode(document.getNodeValue() + "FirstElement");
       if(! (attributeNode == null))
       {
           fprintf(stderr, "Warning!!! DOM_Element's 'getAttributeNode' failed! It should have returned 'null' here!\n");
           OK = false;
       }
  -    
  +
   
       newAttributeNode = document.createAttribute("AnotherFirstElementAttribute");
       newAttributeNode.setValue("A new attribute which helps test calls in DOM_Element");
  @@ -1498,7 +1504,7 @@
       DOM_Node abc12 = nodeMap.getNamedItem("AnotherFirstElementAttribute");
       DOM_Attr fetchedAttr = (DOM_Attr &) abc12;
       if (fetchedAttr != newAttributeNode)
  -    {       
  +    {
           printf("DOM_Element Tests Failure 003\n");
           OK = false;
       };
  @@ -1506,7 +1512,7 @@
       // Fetch the newly added attribute back out directly from the element itself.
       fetchedAttr = element.getAttributeNode("AnotherFirstElementAttribute");
       if (fetchedAttr != newAttributeNode)
  -    {       
  +    {
           printf("DOM_Element Tests Failure 004\n");
           OK = false;
       };
  @@ -1527,13 +1533,13 @@
               printf("\n");
               OK = false;
               break;
  -        }       
  +        }
       //  printf("docElement's number " + i + " is: " + n.getNodeName());
       }
  -    DOM_Node abc15 = document.getElementsByTagName("dBodyLevel21").item(0); // element gets DOM_Element test BodyLevel21 
  +    DOM_Node abc15 = document.getElementsByTagName("dBodyLevel21").item(0); // element gets DOM_Element test BodyLevel21
       element = (DOM_Element &) abc15;
   
  -    DOM_Node abc16 = document.getElementsByTagName("dBodyLevel31").item(0); // element2 gets DOM_Element test BodyLevel31 
  +    DOM_Node abc16 = document.getElementsByTagName("dBodyLevel31").item(0); // element2 gets DOM_Element test BodyLevel31
       element2 = (DOM_Element &) abc16;
       DOM_NodeList text = ((DOM_Node &) element2).getChildNodes();
       int textSize = text.getLength();
  @@ -1569,13 +1575,13 @@
           printf("Warning!!! Comparison of concatenated text nodes created by DOM_Element's 'normalize' failed!\n");
           OK = false;
       }
  -    
  +
       element.setAttribute("FirstElementLastAttribute", "More attribute stuff for firstElement!!");
       element.removeAttribute("FirstElementLastAttribute");
       element.removeAttributeNode(newAttributeNode);
   
       //  doc.getLastChild().setNodeValue("This shouldn't work");//!! Throws a NO_MODIFICATION_ALLOWED_ERR***
  -    
  +
   // For debugging*****       printf("All DOM_Element method calls worked correctly.\n");
       if (!OK)
           printf("\n*****The DOM_Element method calls listed above failed, all others worked correctly.*****\n");
  @@ -1607,7 +1613,7 @@
               ((node.getNodeValue() != null && node2.getNodeValue() != null) ?    // Checks to make sure each node has a value node
                  node.getNodeValue().equals(node2.getNodeValue()) :       // If both have value nodes test those value nodes for equality
                  (node.getNodeValue() == null && node2.getNodeValue() == null)))) // If one node doesn't have a value node make sure both don't
  -    {   
  +    {
           printf("Warning!!! 'cloneNode' did not clone the DOM_Entity node correctly");
           OK = false;
       }
  @@ -1641,14 +1647,14 @@
            (node.getNodeValue() != null && node2.getNodeValue() != null)  // Checks to make sure each node has a value node
           ? node.getNodeValue().equals(node2.getNodeValue())          // If both have value nodes test those value nodes for equality
           :(node.getNodeValue() == null && node2.getNodeValue() == null)))// If one node doesn't have a value node make sure both don't
  -    {   
  +    {
           printf("'cloneNode' did not clone the DOM_EntityReference node correctly\n");
           OK = false;
       }
       // Deep clone test comparison is in testNode & testDocument
   
       //  entityReference.setNodeValue("This shouldn't work");//!! Throws a NO_MODIFICATION_ALLOWED_ERR ********
  -    
  +
   // For debugging*****       printf("All DOM_EntityReference method calls worked correctly.\n");
       if (!OK)
           printf("\n*****The DOM_EntityReference method calls listed above failed, all others worked correctly.*****\n");
  @@ -1683,7 +1689,7 @@
       else
       {
           printf("'cloneNode' did not successfully clone this whole node tree (deep)!\n");
  -        OK = false; 
  +        OK = false;
       }
       //!! The following gives a did not clone successfully message*********
       node = document.getDocumentElement();
  @@ -1699,10 +1705,10 @@
           OK = false;
       }
       // Deep clone test also in testDocument
  -    
  +
   // For debugging*****       printf("All DOM_Node method calls worked correctly.\n");
       if (!OK)
  -        printf("\n*****The DOM_Node method calls listed above failed, all others worked correctly.*****\n");    
  +        printf("\n*****The DOM_Node method calls listed above failed, all others worked correctly.*****\n");
   //  printf("\n");
   };
   
  @@ -1730,14 +1736,14 @@
            (node.getNodeValue() != null && node2.getNodeValue() != null)  // Checks to make sure each node has a value node
           ? node.getNodeValue().equals(node2.getNodeValue())          // If both have value nodes test those value nodes for equality
           :(node.getNodeValue() == null && node2.getNodeValue() == null)))// If one node doesn't have a value node make sure both don't
  -    {   
  +    {
           printf("'cloneNode' did not clone the DOM_Notation node correctly");
           OK = false;
       }
       // Deep clone test comparison is in testNode & testDocument
   
       //  notation.setNodeValue("This shouldn't work");//!! Throws a NO_MODIFICATION_ALLOWED_ERR ********
  -    
  +
   // For debugging*****       printf("All DOM_Notation method calls worked correctly.\n");
       if (!OK)
           printf("\n*****The DOM_Notation method calls listed above failed, all others worked correctly.*****\n");
  @@ -1768,7 +1774,7 @@
            (pI.getNodeValue() != null && pI2.getNodeValue() != null)  // Checks to make sure each node has a value node
           ? pI.getNodeValue().equals(pI2.getNodeValue())      // If both have value nodes test those value nodes for equality
           :(pI.getNodeValue() == null && pI2.getNodeValue() == null)))// If one node doesn't have a value node make sure both don't
  -    {   
  +    {
           printf("'cloneNode' did not clone the DOM_Entity node correctly\n");
           OK = false;
       }
  @@ -1781,29 +1787,29 @@
           printf("Warning!!! PI's 'getData' failed!\n");
           OK = false;
       }
  -    
  +
       pI.setData("PI's reset data");
       compare = "PI's reset data";
       if (! compare.equals(pI.getData()))
       {
           printf("Warning!!! PI's 'setData' failed!\n");
           OK = false;
  -    }   
  +    }
       compare = "dTargetProcessorChannel";
       if (! compare.equals(pI.getTarget()))
       {
           printf("Warning!!! PI's 'getTarget' failed!\n");
           OK = false;
  -    }   
  -    
  +    }
   
  +
       // Restore original PI data.
       pI.setData("This is #document's processing instruction");
   
   // For debugging*****       printf("All PI method calls worked correctly.\n");
       if (!OK)
           printf("\n*****The PI method calls listed above failed, all others worked correctly.*****\n");
  -    
  +
   //  printf("\n");
   };
   
  @@ -1832,7 +1838,7 @@
            (node.getNodeValue() != null && node2.getNodeValue() != null)  // Checks to make sure each node has a value node
           ? node.getNodeValue().equals(node2.getNodeValue())          // If both have value nodes test those value nodes for equality
           :(node.getNodeValue() == null && node2.getNodeValue() == null)))// If one node doesn't have a value node make sure both don't
  -    {   
  +    {
           printf("'cloneNode' did not clone the DOM_Text node correctly\n");
           OK = false;
       }
  @@ -1851,7 +1857,7 @@
       if (! compare.equals(text.getNextSibling().getNodeValue()))
           {
               printf("The second part of DOM_Text's split text failed!\n") ;
  -            OK = false; 
  +            OK = false;
           }
   
       // Re-normalize the text nodes under elem, so that this test can be rerun.
  @@ -1859,15 +1865,15 @@
   
   
   //************************************************* ERROR TESTS
  -    DTest tests;        
  +    DTest tests;
       //!! Throws INDEX_SIZE_ERR ********************
       //  text.splitText(-1);
       //  text.splitText(100);
  -    
  +
   // For debugging*****       printf("All DOM_Text method calls worked correctly.\n");
       if (!OK)
           printf("\n*****The DOM_Text method calls listed above failed, all others worked correctly.*****\n");
  -    
  +
   //  printf("\n");
   };
   
  @@ -1875,7 +1881,7 @@
   
   
   /**
  - * 
  + *
    * @param node org.w3c.dom.DOM_Node
    * @param node2 org.w3c.dom.DOM_Node
    *
  @@ -1883,7 +1889,7 @@
   bool DTest::treeCompare(DOM_Node node, DOM_Node node2)
   {
       bool answer = true;
  -        
  +
       DOM_Node kid, kid2;         // Check the subtree for equality
       kid = node.getFirstChild();
       kid2 = node2.getFirstChild();
  
  
  

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