summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2017-05-24 13:05:37 +0100
committerCarl Hetherington <cth@carlh.net>2017-05-24 13:05:37 +0100
commit9777a3cef3f434c5c9ba60161602a9305c705eb1 (patch)
tree43746220256fd7da67aeb0aa2a67679b90eec3d4 /src
parent494afbcf4720b1e1042ef3cab9b320f03bd4d6f6 (diff)
Add node_children() method.
Diffstat (limited to 'src')
-rw-r--r--src/cxml.cc13
-rw-r--r--src/cxml.h1
2 files changed, 14 insertions, 0 deletions
diff --git a/src/cxml.cc b/src/cxml.cc
index 3248324..77770f9 100644
--- a/src/cxml.cc
+++ b/src/cxml.cc
@@ -74,6 +74,19 @@ cxml::Node::optional_node_child (string name) const
}
list<shared_ptr<cxml::Node> >
+cxml::Node::node_children () const
+{
+ xmlpp::Node::NodeList c = _node->get_children ();
+
+ list<shared_ptr<cxml::Node> > n;
+ for (xmlpp::Node::NodeList::iterator i = c.begin (); i != c.end(); ++i) {
+ n.push_back (shared_ptr<Node> (new Node (*i)));
+ }
+
+ return n;
+}
+
+list<shared_ptr<cxml::Node> >
cxml::Node::node_children (string name) const
{
/* XXX: using find / get_path should work here, but I can't follow
diff --git a/src/cxml.h b/src/cxml.h
index 2636ca0..b7f1ef5 100644
--- a/src/cxml.h
+++ b/src/cxml.h
@@ -200,6 +200,7 @@ public:
boost::shared_ptr<Node> node_child (std::string) const;
boost::shared_ptr<Node> optional_node_child (std::string) const;
+ std::list<boost::shared_ptr<Node> > node_children () const;
std::list<boost::shared_ptr<Node> > node_children (std::string) const;
xmlpp::Node* node () const {