http://nagoya.apache.org/bugzilla/show_bug.cgi?id=2676 *** shadow/2676 Wed Jul 18 10:47:05 2001 --- shadow/2676.tmp.10509 Wed Jul 18 10:47:05 2001 *************** *** 0 **** --- 1,50 ---- + +============================================================================+ + | IDOM: pure virtual called in IDDeepNodeListImpl::item() | + +----------------------------------------------------------------------------+ + | Bug #: 2676 Product: Xerces-C++ | + | Status: NEW Version: 1.5 | + | Resolution: Platform: PC | + | Severity: Normal OS/Version: Other | + | Priority: Other Component: DOM | + +----------------------------------------------------------------------------+ + | Assigned To: [EMAIL PROTECTED] | + | Reported By: [EMAIL PROTECTED] | + | CC list: Cc: | + +----------------------------------------------------------------------------+ + | URL: | + +============================================================================+ + | DESCRIPTION | + I have v1.5.0 and have ported it, albeit somewhat haphazardly, to BeOS. + + Here's the code that triggers the error: + + -------- + + IDOM_Element* elem; // the current element I'm working on + + IDOM_NodeList* descrNodes = elem-> + getElementsByTagName(XCODE_FROM_UTF8("descr").String()); + ASSERT(descrNodes); + + unsigned int len = descrNodes->getLength(); // <-- CRASH here: pure virtual called + for (unsigned int i=0; i<len; i++) { + IDOM_Element* descr = dynamic_cast<IDOM_Element*>(descrNodes->item(i)); + ASSERT(descr); + WriteDescr(descr); + } + + -------- + + The problem? Apparently, getElementsByTagName uses the current element as its root +node, + but IDDeepNodeListImpl::item casts the root node as if it were a document, not an +element. + (This is on line 213 of IDDeepNodeListImpl.cpp in my version of the file.) Changing +this + code to use a safe cast fixes the problem for me, but may not be the behavior you +want: + + const IDDocumentImpl* doc = dynamic_cast<const IDDocumentImpl*>(fRootNode); + if (doc && doc->changes() != fChanges) + { + ... + } + + This problem would seem to answer the question some developer asked in the comment +on line + 211: not every root node is a document. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
