Re: [libxml++] write_to_file_formatted problem
- From: Ignacio Espinosa <iespinosa grupoikusnet com>
- To: Murray Cumming <murrayc murrayc com>
- Cc: libxmlplusplus-general lists sourceforge net
- Subject: Re: [libxml++] write_to_file_formatted problem
- Date: Tue, 25 Mar 2008 23:09:37 -0300
El mar, 18-03-2008 a las 11:54 -0300, Ignacio Espinosa escribió:
> El mar, 18-03-2008 a las 12:59 +0100, Murray Cumming escribió:
> >
> > That shouldn't be necessary. Could you add a simple-as-possible test
> > case to bugzilla?
> >
> Done: http://bugzilla.gnome.org/show_bug.cgi?id=523187
>
> Thanks for the answer :)
>
If the original document it's as simple as decribed in bugtrack, this
procedure (based on dom_parser example) will fix the problem (not
bug :P):
void clean_document (xmlpp::Node* node)
{
xmlpp::ContentNode* nodeContent =
dynamic_cast<xmlpp::ContentNode*>(node);
xmlpp::TextNode* nodeText = dynamic_cast<xmlpp::TextNode*>(node);
if(nodeText && nodeText->is_white_space())
{
xmlpp::Element *parent_e = node->get_parent();
xmlpp::Node *parent_n = dynamic_cast<xmlpp::Node*>(parent_e);
parent_n->remove_child(node);
return;
}
if(!nodeContent)
{
xmlpp::Node::NodeList list = node->get_children();
for(xmlpp::Node::NodeList::iterator iter = list.begin(); iter !=
list.end(); ++iter)
clean_document(*iter);
}
}
Saludos
ignacio.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]