[xmlpp-common] how to get the contents of a xmlpp::Node ?
Brought to you by:
pit22
From: Jan P. <jan...@ya...> - 2006-06-05 15:08:33
|
hi :) I know this is a dumb question ... but apparently there is no obvious answers, and I don't want to write something to go through all the "text" children ... I tried the following: xmlpp::Node *frob_node = get_nontext_node( root->get_children() ); // i wrote this utility function to search for the first non "text" child, is there an easier way ? if ( ! frob_node || frob_node->get_name() != "frob" ) throw runtime_error( "FlickrAPI::getFrob(): missing \"frob\" child for root \"rsp\" node, got "+frob_node->get_name() ); xmlpp::ContentNode content( frob_node->cobj() ); string result = content.get_content(); but as expected, I got memory errors because of and object being freed twice (frob_node->cobj() I believe): *** glibc detected *** double free or corruption (out): 0x00007fffffb14cf0 *** Aborted thanks for any hints - jan |