Revert 3b6dd4db.
authorCarl Hetherington <cth@carlh.net>
Sun, 29 Sep 2013 08:28:23 +0000 (09:28 +0100)
committerCarl Hetherington <cth@carlh.net>
Sun, 29 Sep 2013 08:28:23 +0000 (09:28 +0100)
src/cxml.cc
test/tests.cc

index ddfa00f3d90ff03411f17bd0e9575a76cb031623..2ca46ed46971f97d2964f0065d22856cb2219b25 100644 (file)
@@ -57,11 +57,17 @@ cxml::Node::optional_node_child (string name) const
 list<shared_ptr<cxml::Node> >
 cxml::Node::node_children (string name) const
 {
-       xmlpp::NodeSet c = _node->find (name);
+       /* XXX: using find / get_path should work here, but I can't follow
+          how get_path works.
+       */
+
+       xmlpp::Node::NodeList c = _node->get_children ();
        
        list<shared_ptr<cxml::Node> > n;
-       for (xmlpp::NodeSet::iterator i = c.begin (); i != c.end(); ++i) {
-               n.push_back (shared_ptr<Node> (new Node (*i)));
+       for (xmlpp::Node::NodeList::iterator i = c.begin (); i != c.end(); ++i) {
+               if ((*i)->get_name() == name) {
+                       n.push_back (shared_ptr<Node> (new Node (*i)));
+               }
        }
        
        _taken.push_back (name);
index 90b31cbd1797689baa83073f136bb8d3378c9941..fc1603111e80ba8d27c0a9a2a00e5ed390b23c48 100644 (file)
@@ -73,4 +73,5 @@ BOOST_AUTO_TEST_CASE (test)
        BOOST_CHECK_EQUAL (document.node_children("H/I").back()->content(), "more testing");
 
        BOOST_CHECK_EQUAL (document.string_child("J/K"), "jim");
+       BOOST_CHECK (!document.optional_bool_child("G"));
 }