I have added this portion to my original posting...
 
replace()
{
   // parse out the node and replace old value
   // with this new node.
  ... (code taken out)
 
   try
   {   
      // remove the old one here.
        node->getParentNode()->removeChild(node);
        node->release();
 
        doc->importNode(newnode, true);
      }
      catch(DOMException &exception)
       {
            cout << "error code is " << exception.code << endl;
       }
}
 
and inside my main body...
 
main(int argc, char* argv[])
{  
// parsing document
(code taken out)
   dn = (DOMNode*)doc->getDocumentElement();
   de = (DOMElement*)dn;
   List = de->getElementsByTagName(feature);
   count = List->getLength();
   cout << "count is " << count << endl; // correct number of count is displayed
 
   replace();
   dn = (DOMNode*)doc->getDocumentElement();
   de = (DOMElement*)dn;
   List = de->getElementsByTagName(feature);
   count = List->getLength();
   cout << "count is " << count << endl; // this line displays one less than expected?!
}
 
my current DOMDocument doc is global, my first display of count should be the
same as my second display of count. Since one node is removed and then another
one is imported into my DOMDocument.
 
Also, if I replace my second one of    dn = (DOMNode*)doc->getDocumentElement();
dn=doc->getFirstChild() my program would crash.
 
Any ideas would be greatly appreciated.
-- Jimmy
____________________________________________
Taxes and golf are alike, you drive your heart out for the
green, and then end up in the hole. - Source unknown

Reply via email to