summaryrefslogtreecommitdiff
path: root/project2/variables.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'project2/variables.cpp')
-rw-r--r--project2/variables.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/project2/variables.cpp b/project2/variables.cpp
index 2b2872d..a5cfa0d 100644
--- a/project2/variables.cpp
+++ b/project2/variables.cpp
@@ -1,4 +1,5 @@
#include "variables.h"
+#include "xmlObjectLoader.h"
#include "exceptions.h"
#include "appEngine.h"
#include "session.h"
@@ -389,8 +390,17 @@ Variable::Variable(const xmlpp::Element * e, const Glib::ustring & n, bool requi
var = new VariableParam(c);
else if (source == "config")
var = new VariableConfig(c);
- else if (source == "literal" || source.empty())
- var = new VariableLiteral(c->get_attribute_value("value"), getVariableTypeFromName(c->get_attribute_value("type")));
+ else if (source == "literal" || source.empty()) {
+ if (const xmlpp::Attribute * la = c->get_attribute("value")) {
+ var = new VariableLiteral(la->get_value(), getVariableTypeFromName(c->get_attribute_value("type")));
+ }
+ else if (const xmlpp::TextNode * t = c->get_child_text()) {
+ var = new VariableLiteral(t->get_content(), getVariableTypeFromName(c->get_attribute_value("type")));
+ }
+ else {
+ var = new VariableLiteral(VariableType());
+ }
+ }
else
throw UnknownVariableSource(source);
return;