Add node_children() method.
authorCarl Hetherington <cth@carlh.net>
Wed, 24 May 2017 12:05:37 +0000 (13:05 +0100)
committerCarl Hetherington <cth@carlh.net>
Wed, 24 May 2017 12:05:37 +0000 (13:05 +0100)
src/cxml.cc
src/cxml.h

index 3248324bb8b8c6e69e0e9d864182e508e4f02145..77770f93b0fb7ad943de5863cc72a151d79db518 100644 (file)
@@ -73,6 +73,19 @@ cxml::Node::optional_node_child (string name) const
        return n.front ();
 }
 
+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
 {
index 2636ca093ceed762b20f6e9b79f841b17e96b50e..b7f1ef578a9093c3cb4b21e5bc3d557ca50d744e 100644 (file)
@@ -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 {