aboutsummaryrefslogtreecommitdiff
path: root/src/function/transform.cc
diff options
context:
space:
mode:
authorAdrian Kummerländer2014-05-31 14:18:48 +0200
committerAdrian Kummerländer2014-05-31 14:18:48 +0200
commit1a744712426c9c19019b8ebebdd0c703aae204a6 (patch)
treefd82b4e5b0e53b39dd0d9df5e5dda6aa0f050eb0 /src/function/transform.cc
parentd5367d268e8f2be9dd519b3b90f7baa64d6d50b7 (diff)
downloadInputXSLT-1a744712426c9c19019b8ebebdd0c703aae204a6.tar
InputXSLT-1a744712426c9c19019b8ebebdd0c703aae204a6.tar.gz
InputXSLT-1a744712426c9c19019b8ebebdd0c703aae204a6.tar.bz2
InputXSLT-1a744712426c9c19019b8ebebdd0c703aae204a6.tar.lz
InputXSLT-1a744712426c9c19019b8ebebdd0c703aae204a6.tar.xz
InputXSLT-1a744712426c9c19019b8ebebdd0c703aae204a6.tar.zst
InputXSLT-1a744712426c9c19019b8ebebdd0c703aae204a6.zip
Revamped external function result trees
* the root node of the result tree of each function is a domain element ** i.e. the root node of "read-xml-file" is "file", the root node of "read-directory" is "directory" * the root node contains the result state of the function call encoded in a "result" attribute ** possible values are "success" and "error" ** the root node may contain additional attributes such as the target path of a called transformation * the actual function result is contained within the child nodes of the function root node ** i.e. the XML file tree returned by "read-xml-file" is a child of the function root node ** if specific errors occured they are also returned as child nodes of the function root node *** this is currently only the case for "transform" where transformation errors are returned as "error" value node childs of the function root node * updated test cases accordingly
Diffstat (limited to 'src/function/transform.cc')
-rw-r--r--src/function/transform.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/function/transform.cc b/src/function/transform.cc
index e952018..ab8c51c 100644
--- a/src/function/transform.cc
+++ b/src/function/transform.cc
@@ -38,8 +38,8 @@ xercesc::DOMDocument* FunctionTransform::constructDocument(
domDocument->getDocumentElement()
);
- ResultNodeFacade result(domDocument, rootNode, "result");
- result.setAttribute("name", targetPath);
+ ResultNodeFacade result(domDocument, rootNode, "transformation");
+ result.setAttribute("target", targetPath);
try {
InputXSLT::TransformationFacade transformation(
@@ -48,8 +48,12 @@ xercesc::DOMDocument* FunctionTransform::constructDocument(
);
transformation.generate(targetPath, parameterObject);
+
+ result.setAttribute("result", "success");
}
catch (const ErrorCapacitor::exception& exception) {
+ result.setAttribute("result", "error");
+
for ( auto&& error : *(exception.getCachedErrors()) ) {
result.setValueNode("error", error);
}