Hi, I'm having a problem building a Domparser. The code below run properly qnd after debugging it exits normally as well.
It seems the problem comes from the transcode method. If i remove the transcode it returns the corresponding encoded value but like that it return nothing and it dies after i call the transcode method.
for( std::vector<std::string>::iterator tag = tags.begin(); tag !=tags.end(); tag++) { char *query = strdup((*tag).c_str()); XMLCh* tmpstr = XMLString::transcode(query);
int len; c_nodelist = c_doc->getElementsByTagName(tmpstr); len = c_nodelist->getLength(); std::cout << "LEN " << len << std::endl; for (int i = 0 ; i < len ; i++) { c_node = c_nodelist->item(i); const XMLCh* val = c_node->getNodeValue(); char *test = XMLString::transcode(val); std::cout <<"Val: " << XMLString::transcode(val); }
You are calling getNodeValue() on a DOMElement node, and this method will always return NULL in this case; I guess what you really want to do is invoke getTextContent()
Alberto
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
