diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-04-12 15:10:36 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-04-12 15:10:36 (GMT) |
commit | 72fb2cd0bd89eb40d4a96f86d464d9801ad91f59 (patch) | |
tree | ea6ec14f4da720b2ec80d9b1c10904f13ee43d32 /src/uscxml/plugins/datamodel/xpath | |
parent | ba050afaaad699e60ca657b311d5c34d038bb89c (diff) | |
download | uscxml-72fb2cd0bd89eb40d4a96f86d464d9801ad91f59.zip uscxml-72fb2cd0bd89eb40d4a96f86d464d9801ad91f59.tar.gz uscxml-72fb2cd0bd89eb40d4a96f86d464d9801ad91f59.tar.bz2 |
Got prolog datamodel to compile again
Diffstat (limited to 'src/uscxml/plugins/datamodel/xpath')
-rw-r--r-- | src/uscxml/plugins/datamodel/xpath/XPathDataModel.cpp | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/uscxml/plugins/datamodel/xpath/XPathDataModel.cpp b/src/uscxml/plugins/datamodel/xpath/XPathDataModel.cpp index eef8e51..0c649f5 100644 --- a/src/uscxml/plugins/datamodel/xpath/XPathDataModel.cpp +++ b/src/uscxml/plugins/datamodel/xpath/XPathDataModel.cpp @@ -187,7 +187,30 @@ bool XPathDataModel::evalAsBool(const std::string& expr) { std::string XPathDataModel::evalAsString(const std::string& expr) { XPathValue<std::string> result = _xpath.evaluate_expr(expr, _doc); - return result.asString(); + switch (result.type()) { + case STRING: + return result.asString(); + break; + case BOOL: + return (result.asBool() ? "true" : "false"); + break; + case NUMBER: + return toStr(result.asNumber()); + break; + case NODE_SET: { + NodeSet<std::string> nodeSet = result.asNodeSet(); + std::stringstream ss; + for (int i = 0; i < nodeSet.size(); i++) { + ss << nodeSet[i] << std::endl; + } + return ss.str(); + break; + } + case ANY: + throw Event("error.execution", Event::PLATFORM); + break; + } + return "undefined"; } double XPathDataModel::evalAsNumber(const std::string& expr) { |