From f05e742b88e3ebf7401c252332022f1a2f7eb8b0 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Fri, 4 Jul 2014 22:41:17 +0200 Subject: Changed FunctionTransform result type to node-set * using xalan::FormatterToXercesDOM internally ** this required changes to the TransformationFacade::generate member method overloads * TransformationFacade::generate now accepts references to xalan::FormatterListener instances ** "generate(std::basic_ostream&..." instantiates a xalan::FormatterToXML and passes it to the actual generate member method * changed ResultNodeFacade's "getNode" method into a "getResultElement" method ** xalan::FormatterToXercesDOM requires a xercesc::DOMElement instance instead of the previously available xercesc::DOMNode instance ** changed FunctionReadDirectory accordingly * adapted FunctionTransform test case accordingly --- src/function/read_directory.cc | 2 +- src/function/transform.cc | 19 +++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) (limited to 'src/function') diff --git a/src/function/read_directory.cc b/src/function/read_directory.cc index 884963e..d5357e8 100644 --- a/src/function/read_directory.cc +++ b/src/function/read_directory.cc @@ -29,7 +29,7 @@ xercesc::DOMDocument* FunctionReadDirectory::constructDocument( if ( boost::filesystem::is_directory(directoryPath) ) { result.setAttribute("result", "success"); - xercesc::DOMNode* const resultNode = result.getNode(); + xercesc::DOMNode* const resultNode = result.getResultElement(); FilesystemContext::iterate( directoryPath, diff --git a/src/function/transform.cc b/src/function/transform.cc index bc71125..1d22399 100644 --- a/src/function/transform.cc +++ b/src/function/transform.cc @@ -1,11 +1,11 @@ #include "transform.h" +#include + #include #include #include -#include - #include "transformation_facade.h" #include "support/xerces_string_guard.h" #include "support/dom/result_node_facade.h" @@ -43,11 +43,11 @@ xercesc::DOMDocument* FunctionTransform::constructDocument( ) ); - xercesc::DOMNode* const rootNode( + xercesc::DOMElement* const rootElement( domDocument->getDocumentElement() ); - ResultNodeFacade result(domDocument, rootNode, "transformation"); + ResultNodeFacade result(domDocument, rootElement, "transformation"); if ( auto transformation = TransformationFacade::try_create( handleErrors(result), @@ -56,17 +56,16 @@ xercesc::DOMDocument* FunctionTransform::constructDocument( this->include_resolver_ ) ) { try { - std::stringstream targetStream; + xalan::FormatterToXercesDOM formatter( + domDocument, + result.getResultElement() + ); transformation->generate( - targetStream, + formatter, parameterObject ); - result.setContent( - targetStream.str() - ); - result.setAttribute("result", "success"); } catch (const ErrorCapacitor::exception& exception) { -- cgit v1.2.3