Re: [libxml++] ignore empty text nodes
- From: Andrej van der Zee <andrejvanderzee gmail com>
- To: Knut Aksel Røysland <knutroy ifi uio no>
- Cc: libxmlplusplus-general lists sourceforge net
- Subject: Re: [libxml++] ignore empty text nodes
- Date: Sun, 28 Mar 2010 10:46:31 +0900
Hi,
>
> void remove_whitespace_nodes(xmlpp::Document & doc)
> {
> xmlpp::NodeSet whitespace_nodes =
> doc.get_root_node()->find("//text()[normalize-space()='']");
> for (xmlpp::NodeSet::const_iterator it = whitespace_nodes.begin();
> it != whitespace_nodes.end();
> ++it)
> {
> (*it)->get_parent()->remove_child(*it);
> }
> }
>
Thank you, that's a nice one!
Greets,
Andrej
[
Date Prev][
Date Next] [
Thread Prev][Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]