diff options
Diffstat (limited to 'slicer/xml/serializer.cpp')
-rw-r--r-- | slicer/xml/serializer.cpp | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/slicer/xml/serializer.cpp b/slicer/xml/serializer.cpp index 225a1b3..6f5df3a 100644 --- a/slicer/xml/serializer.cpp +++ b/slicer/xml/serializer.cpp @@ -14,13 +14,10 @@ namespace Slicer { const std::string md_bare = "xml:bare"; const auto defaultElementCreator = boost::bind(&xmlpp::Element::add_child, _1, _2, Glib::ustring()); - class BadBooleanValue : public std::invalid_argument { - public: - BadBooleanValue(const Glib::ustring &) : - std::invalid_argument("Bad boolean value") - { - } - }; + BadBooleanValue::BadBooleanValue(const Glib::ustring &) : + std::invalid_argument("Bad boolean value") + { + } static const Glib::ustring TrueText("true"); static const Glib::ustring FalseText("false"); @@ -80,6 +77,10 @@ namespace Slicer { class XmlContentValueSource : public XmlValueSource { public: + XmlContentValueSource() : + XmlValueSource(Glib::ustring()) + { + } XmlContentValueSource(const xmlpp::ContentNode * c) : XmlValueSource(c->get_content()) { @@ -190,7 +191,13 @@ namespace Slicer { if (!attrs.empty()) { DocumentTreeIterate(attrs.front(), smp); } - DocumentTreeIterate(element->get_first_child(), smp); + auto firstChild = element->get_first_child(); + if (firstChild) { + DocumentTreeIterate(firstChild, smp); + } + else { + smp->SetValue(new XmlContentValueSource()); + } smp->Complete(); } } |