| | |
Child removal problem with Xerces
Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved |
I need help with the code below. At root->removeChild(nodeToRemove), I have a NOT_FOUND_ERR code. It is not supposed to return this code, because I look in the DOM Tree with IsInDocument.
Can someone tell me what's wrong with this code. I'm becoming blind with this code.
When I debug, this is where an exception is thrown.
Can someone tell me what's wrong with this code. I'm becoming blind with this code.
C++ Syntax (Toggle Plain Text)
DOMNode* nodeToRemove; if ((nodeToRemove = IsInDocument(root, *it)) != 0) { if (nodeToRemove->isEqualNode(root)) { root = 0; break; } root->removeChild(nodeToRemove); }
C++ Syntax (Toggle Plain Text)
DOMNode* IsInDocument(DOMNode* node, DOMNode* toFind) { if (node->isEqualNode(toFind)) { return node; } else { node = node->getFirstChild(); while (node != 0) { DOMNode* retval; if ((retval = IsInDocument(node, toFind)) != 0) { return retval; } node = node->getNextSibling(); } return 0; } }
When I debug, this is where an exception is thrown.
C++ Syntax (Toggle Plain Text)
if (castToNodeImpl(this)->isReadOnly()) throw DOMException( DOMException::NO_MODIFICATION_ALLOWED_ERR, 0, GetDOMParentNodeMemoryManager); if (oldChild == 0 || oldChild->getParentNode() != castToNode(this)) throw DOMException(DOMException::NOT_FOUND_ERR, 0, GetDOMParentNodeMemoryManager); if (this->getOwnerDocument() != 0 ) { //notify iterators NodeIterators* nodeIterators = ((DOMDocumentImpl *)this->getOwnerDocument())->getNodeIterators(); if (nodeIterators != 0) { XMLSize_t sz = nodeIterators->size(); if (sz != 0) { for (XMLSize_t i =0; i<sz; i++) { if (nodeIterators->elementAt(i) != 0) nodeIterators->elementAt(i)->removeNode(oldChild); } } }
Last edited by GDICommander; Mar 17th, 2009 at 10:07 am.
![]() |
Other Threads in the C++ Forum
- Previous Thread: windows.h error
- Next Thread: Input Questions
| Thread Tools | Search this Thread |
api array based beginner binary c++ c/c++ calculator char char* class classes code compile compiler console conversion count delete deploy desktop directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker linux list loop looping loops map math matrix memory news node numbertoword output parameter pointer problem program programming project python random read recursion recursive reference return rpg sorting string strings struct temperature template templates test text text-file tree unix url variable vector video visualstudio win32 windows winsock word wordfrequency wxwidgets





