summaryrefslogtreecommitdiffstats
path: root/src/bindings/swig/uscxml_beautify.i
diff options
context:
space:
mode:
Diffstat (limited to 'src/bindings/swig/uscxml_beautify.i')
-rw-r--r--src/bindings/swig/uscxml_beautify.i22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/bindings/swig/uscxml_beautify.i b/src/bindings/swig/uscxml_beautify.i
index bf54958..751be78 100644
--- a/src/bindings/swig/uscxml_beautify.i
+++ b/src/bindings/swig/uscxml_beautify.i
@@ -114,6 +114,10 @@
};
+%{
+ #include <glog/logging.h>
+%}
+
%extend uscxml::Data {
std::vector<std::string> getCompoundKeys() {
std::vector<std::string> keys;
@@ -124,4 +128,22 @@
}
return keys;
}
+
+ std::string getXML() {
+ if (!self->node)
+ return "";
+
+ std::stringstream ss;
+ ss << self->node;
+ return ss.str();
+ }
+
+ void setXML(const std::string& xml) {
+ NameSpacingParser parser = NameSpacingParser::fromXML(xml);
+ if (!parser.errorsReported()) {
+ self->node = parser.getDocument();
+ } else {
+ LOG(ERROR) << "Cannot parse message as XML: " << parser.errors();
+ }
+ }
};