Add Document::read_string().
authorCarl Hetherington <cth@carlh.net>
Sun, 20 Jul 2014 22:38:34 +0000 (23:38 +0100)
committerCarl Hetherington <cth@carlh.net>
Sun, 20 Jul 2014 22:38:34 +0000 (23:38 +0100)
src/cxml.cc
src/cxml.h

index 99055ee1da521aff6e0a4e12c9410f24eef22a3e..810abf81deae977c61ee11944382af10bff5eaf8 100644 (file)
@@ -267,6 +267,14 @@ cxml::Document::read_stream (istream& stream)
        take_root_node ();
 }
 
+void
+cxml::Document::read_string (string s)
+{
+       stringstream t (s);
+       _parser->parse_stream (t);
+       take_root_node ();
+}
+
 void
 cxml::Document::take_root_node ()
 {
index a8da82a42b8791a41e1eb1890f3e442b6b9314ad..ce62ca9664211d36129dc41fb02f0246217bb2ad 100644 (file)
@@ -221,6 +221,7 @@ public:
 
        void read_file (boost::filesystem::path);
        void read_stream (std::istream &);
+       void read_string (std::string);
        
        std::string root_name () const {
                return _root_name;