From 3b6ddf4b140befd1286af26c34800a50b3ba3f56 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 26 Sep 2013 00:38:43 +0100 Subject: Use xpath for node_children. --- src/cxml.cc | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'src/cxml.cc') diff --git a/src/cxml.cc b/src/cxml.cc index 2ca46ed..ddfa00f 100644 --- a/src/cxml.cc +++ b/src/cxml.cc @@ -57,17 +57,11 @@ cxml::Node::optional_node_child (string name) const list > cxml::Node::node_children (string name) const { - /* XXX: using find / get_path should work here, but I can't follow - how get_path works. - */ - - xmlpp::Node::NodeList c = _node->get_children (); + xmlpp::NodeSet c = _node->find (name); list > n; - for (xmlpp::Node::NodeList::iterator i = c.begin (); i != c.end(); ++i) { - if ((*i)->get_name() == name) { - n.push_back (shared_ptr (new Node (*i))); - } + for (xmlpp::NodeSet::iterator i = c.begin (); i != c.end(); ++i) { + n.push_back (shared_ptr (new Node (*i))); } _taken.push_back (name); -- cgit v1.2.3