diff options
| author | Carl Hetherington <cth@carlh.net> | 2012-09-09 18:12:32 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2012-09-09 18:12:32 +0100 |
| commit | 8411002d2c768dfaaa4b89cf6a2b12b3967f1f69 (patch) | |
| tree | 35f43d5f12ca34868c7b64de1671ca72b38177b1 /src/xml.cc | |
| parent | c1798d06bb87eddfb08945893b0b9166fd097f93 (diff) | |
Clean up and fix subtitle parsing a bit.
Diffstat (limited to 'src/xml.cc')
| -rw-r--r-- | src/xml.cc | 21 |
1 files changed, 8 insertions, 13 deletions
@@ -226,22 +226,17 @@ XMLNode::done () string XMLNode::content () { + string content; + xmlpp::Node::NodeList c = _node->get_children (); - - if (c.size() > 1) { - throw XMLError ("unexpected content in XML node"); + for (xmlpp::Node::NodeList::const_iterator i = c.begin(); i != c.end(); ++i) { + xmlpp::ContentNode const * v = dynamic_cast<xmlpp::ContentNode const *> (*i); + if (v) { + content += v->get_content (); + } } - if (c.empty ()) { - return ""; - } - - xmlpp::ContentNode const * v = dynamic_cast<xmlpp::ContentNode const *> (c.front()); - if (!v) { - throw XMLError ("missing content in XML node"); - } - - return v->get_content (); + return content; } XMLFile::XMLFile (string file, string root_name) |
