From a7b6fa909acdc58b9eac6b563fab8f4d9999b898 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 20 Jul 2014 23:38:34 +0100 Subject: Add Document::read_string(). --- src/cxml.cc | 8 ++++++++ src/cxml.h | 1 + 2 files changed, 9 insertions(+) (limited to 'src') diff --git a/src/cxml.cc b/src/cxml.cc index 99055ee..810abf8 100644 --- a/src/cxml.cc +++ b/src/cxml.cc @@ -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 () { diff --git a/src/cxml.h b/src/cxml.h index a8da82a..ce62ca9 100644 --- a/src/cxml.h +++ b/src/cxml.h @@ -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; -- cgit v1.2.3