diff options
| author | Carl Hetherington <cth@carlh.net> | 2014-07-20 23:38:34 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2014-07-20 23:38:34 +0100 |
| commit | a7b6fa909acdc58b9eac6b563fab8f4d9999b898 (patch) | |
| tree | 5f3ace0b91384ba0a89b3fe32da1e8d4305b4b37 | |
| parent | 911c706bdd84e7efe05f373131a6fd8b9314f159 (diff) | |
Add Document::read_string().
| -rw-r--r-- | src/cxml.cc | 8 | ||||
| -rw-r--r-- | src/cxml.h | 1 |
2 files changed, 9 insertions, 0 deletions
diff --git a/src/cxml.cc b/src/cxml.cc index 99055ee..810abf8 100644 --- a/src/cxml.cc +++ b/src/cxml.cc @@ -268,6 +268,14 @@ cxml::Document::read_stream (istream& stream) } void +cxml::Document::read_string (string s) +{ + stringstream t (s); + _parser->parse_stream (t); + take_root_node (); +} + +void cxml::Document::take_root_node () { if (!_parser) { @@ -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; |
