how to get innerText with libxml++ ?
May 20, 2016 at 10:34pm UTC
Hi,
I develop application to parse a html file with libxml++.
I using TextNode to get texts of Element but it doesn't return texts of children elements.
Is there way to get InnerText ?
A part of code is below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
NodeSet fields = table->find("tbody/tr/td" );
#ifdef DEBUG
cout << "Fields Count : " << fields.size() << endl;
#endif
NodeSet::const_iterator fieldsIt=fields.begin();
fieldsIt+=3;
for (;fieldsIt!=fields.end();fieldsIt++){
cout << ((Element *)(*fieldsIt))->get_child_text()->get_content();
fieldsIt++;
//FieldType
cout << " : " << ((Element *)(*fieldsIt))->get_child_text()->get_content() << " ; //" ;
fieldsIt++;
try {
cout << " : " << ((Element *)(*fieldsIt))->get_child_text()->get_content();
} catch (Glib::ConvertError e){
}
cout << endl;
}
Last edited on May 20, 2016 at 10:34pm UTC
Topic archived. No new replies allowed.