crashed when casting from DOMNode* to DOMElement*, why?

M

Meal

The last line of the following codes makes the program crash.
I cannot debug into the codes. It looks that I cannot use the
dynamic_cast, but why?
The cout shows that the node is DOM element node. I think it's
possible to cast it from DOMNode* to DOMElement*.
I need the cast to use method getElementsByTagName() which DOMNode
doesn't have.

XMLCh* tagTuple = XMLString::transcode("tuple");
DOMNodeList * listTuple = doc->getElementsByTagName(tagTuple);
XMLString::release(&tagTuple);

if(listTuple->getLength()==0)
{
return;
}
//For the first tuple
cout<<listTuple->item(0)->getNodeType()<<endl;
DOMElement* tuple = dynamic_cast<DOMElement*>(listTuple->item(0));
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top