From 8411002d2c768dfaaa4b89cf6a2b12b3967f1f69 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 9 Sep 2012 18:12:32 +0100 Subject: Clean up and fix subtitle parsing a bit. --- src/xml.cc | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) (limited to 'src/xml.cc') diff --git a/src/xml.cc b/src/xml.cc index 7ca3cc1a..4982e9fb 100644 --- a/src/xml.cc +++ b/src/xml.cc @@ -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 (*i); + if (v) { + content += v->get_content (); + } } - if (c.empty ()) { - return ""; - } - - xmlpp::ContentNode const * v = dynamic_cast (c.front()); - if (!v) { - throw XMLError ("missing content in XML node"); - } - - return v->get_content (); + return content; } XMLFile::XMLFile (string file, string root_name) -- cgit v1.2.3