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/28 21:07:43 UTC

cvs commit: xml-xerces/c/samples/IDOMCount IDOMCount.cpp

tng         01/11/28 12:07:43

  Modified:    c/samples/IDOMCount IDOMCount.cpp
  Log:
  [Bug 4544] DOM_NodeList::getLength incorrect when called twice for empty list.  Test the getElementsByTagName and getLength in IDOMCount.
  
  Revision  Changes    Path
  1.14      +10 -2     xml-xerces/c/samples/IDOMCount/IDOMCount.cpp
  
  Index: IDOMCount.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/samples/IDOMCount/IDOMCount.cpp,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- IDOMCount.cpp	2001/10/29 17:02:57	1.13
  +++ IDOMCount.cpp	2001/11/28 20:07:43	1.14
  @@ -55,7 +55,7 @@
    */
   
   /*
  - * $Id: IDOMCount.cpp,v 1.13 2001/10/29 17:02:57 tng Exp $
  + * $Id: IDOMCount.cpp,v 1.14 2001/11/28 20:07:43 tng Exp $
    */
   
   // ---------------------------------------------------------------------------
  @@ -67,6 +67,7 @@
   #include <parsers/IDOMParser.hpp>
   #include <idom/IDOM_DOMException.hpp>
   #include <idom/IDOM_Document.hpp>
  +#include <idom/IDOM_NodeList.hpp>
   #include "IDOMCount.hpp"
   #include <string.h>
   #include <stdlib.h>
  @@ -328,8 +329,15 @@
           {
               IDOM_Document *doc = parser->getDocument();
               unsigned int elementCount = 0;
  -            if (doc)
  +            if (doc) {
                   elementCount = countChildElements((IDOM_Node*)doc->getDocumentElement());
  +                // test getElementsByTagName and getLength
  +                XMLCh xa[] = {chAsterisk, chNull};
  +                if (elementCount != doc->getElementsByTagName(xa)->getLength()) {
  +                    cout << "\nErrors occured, element count is wrong\n" << endl;
  +                    errorOccurred = true;
  +                }
  +            }
   
               // Print out the stats that we collected and time taken.
               cout << xmlFile << ": " << duration << " ms ("
  
  
  

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