aboutsummaryrefslogtreecommitdiff
path: root/src/transformation_facade.cc
diff options
context:
space:
mode:
authorAdrian Kummerlaender2014-07-05 21:55:48 +0200
committerAdrian Kummerlaender2014-07-05 21:55:48 +0200
commita02dce3c8e6086acbfe9c57c3ee4bb386bfbebc2 (patch)
tree669ad392772fcc9ab4eaa9e1a410156d6d4cc616 /src/transformation_facade.cc
parentf05e742b88e3ebf7401c252332022f1a2f7eb8b0 (diff)
downloadInputXSLT-a02dce3c8e6086acbfe9c57c3ee4bb386bfbebc2.tar
InputXSLT-a02dce3c8e6086acbfe9c57c3ee4bb386bfbebc2.tar.gz
InputXSLT-a02dce3c8e6086acbfe9c57c3ee4bb386bfbebc2.tar.bz2
InputXSLT-a02dce3c8e6086acbfe9c57c3ee4bb386bfbebc2.tar.lz
InputXSLT-a02dce3c8e6086acbfe9c57c3ee4bb386bfbebc2.tar.xz
InputXSLT-a02dce3c8e6086acbfe9c57c3ee4bb386bfbebc2.tar.zst
InputXSLT-a02dce3c8e6086acbfe9c57c3ee4bb386bfbebc2.zip
Revamped implementation to support FunctionTransform XalanNode input
* FunctionTransform now accepts xalan::XalanNode base xalan::XSLTInputSource instances as input parameter ** such xalan::XSLTInputSource instances were already supported for the stylesheet parameter but not for the input parameter ** e.g. it is now possible to generate a DOM inside a transformation, pass the DOM into a embedded transformation as input, modifiy the output of that transformation, pass this modified DOM into another transformation and so on... you get the point * this required a revamp of TransformationFacade ** it is now a transformation independent wrapper for xalan::XalanTransformer *** as such is was renamed to TransformerFacade ** removed error catching template factory method "try_create" as it is not needed anymore ** "std::basic_ostream<char>&" taking "generate" member method overloads were removed ** the set of "generate" member overloads was reduced to two methods accepting xalan::XSLTInputSource and xalan::FormatterListener as parameters * the core problem first documented in 299d0f6 was solved by transforming the input parameter into a xerces DOM and wrapping this DOM inside a xalan::XercesDOMWrapperParsedSource instance * serialization of the transformation result for file / std::cout output is now performed directly by the ixslt frontend * removed 'stylesheet parameter' parameter from FunctionTransform ** the functionality provided by this is easily replicated using the now possible DOM input parameter ** this was done to simplify the interface and reduce unnecessary feature duplication * updated FunctionTransform test case accordingly * added "generate" template function to ixslt frontend ** wraps TransformerFacade and manages ist input arguments ** handles serialization to stream * this commit marks a important milestone towards the goals defined in 741a70f
Diffstat (limited to 'src/transformation_facade.cc')
-rw-r--r--src/transformation_facade.cc116
1 files changed, 0 insertions, 116 deletions
diff --git a/src/transformation_facade.cc b/src/transformation_facade.cc
deleted file mode 100644
index 4017cd0..0000000
--- a/src/transformation_facade.cc
+++ /dev/null
@@ -1,116 +0,0 @@
-#include "transformation_facade.h"
-
-#include <xalanc/XSLT/XSLTInputSource.hpp>
-#include <xalanc/XalanTransformer/XalanCompiledStylesheet.hpp>
-#include <xalanc/PlatformSupport/XalanOutputStreamPrintWriter.hpp>
-#include <xalanc/PlatformSupport/XalanStdOutputStream.hpp>
-#include <xalanc/XMLSupport/FormatterToXML.hpp>
-
-#include "support/xerces_string_guard.h"
-
-namespace InputXSLT {
-
-TransformationFacade::TransformationFacade(
- xalan::XSLTInputSource transformation,
- IncludeEntityResolver* resolver
-):
- input_{},
- transformation_{},
- transformer_(),
- error_multiplexer_(&transformer_),
- warning_capacitor_(&error_multiplexer_) {
- this->transformer_.setEntityResolver(resolver);
-
- ErrorCapacitor errorCapacitor(&this->error_multiplexer_);
-
- std::stringstream dummyStream("<dummy/>");
-
- this->transformer_.parseSource(
- xalan::XSLTInputSource(dummyStream),
- this->input_
- );
-
- this->transformer_.compileStylesheet(
- transformation,
- this->transformation_
- );
-
- errorCapacitor.discharge();
-}
-
-TransformationFacade::TransformationFacade(
- xalan::XSLTInputSource input,
- xalan::XSLTInputSource transformation,
- IncludeEntityResolver* resolver
-):
- input_{},
- transformation_{},
- transformer_(),
- error_multiplexer_(&transformer_),
- warning_capacitor_(&error_multiplexer_) {
- this->transformer_.setEntityResolver(resolver);
-
- ErrorCapacitor errorCapacitor(&this->error_multiplexer_);
-
- this->transformer_.parseSource(
- input,
- this->input_
- );
-
- this->transformer_.compileStylesheet(
- transformation,
- this->transformation_
- );
-
- errorCapacitor.discharge();
-}
-
-WarningCapacitor::warning_cache_ptr TransformationFacade::getCachedWarnings() {
- return this->warning_capacitor_.discharge();
-}
-
-void TransformationFacade::generate(
- std::basic_ostream<char>& targetStream,
- const xalan::XObjectPtr& parameter
-) {
- StylesheetParameterGuard guard(this->transformer_);
- guard.set("parameters", parameter);
-
- this->generate(targetStream);
-}
-
-void TransformationFacade::generate(std::basic_ostream<char>& targetStream) {
- StylesheetParameterGuard guard(this->transformer_);
-
- xalan::XalanStdOutputStream outputStream(targetStream);
- xalan::XalanOutputStreamPrintWriter outputWriter(outputStream);
-
- xalan::FormatterToXML formatter(outputWriter);
- formatter.setDoIndent(true);
-
- this->generate(formatter);
-}
-
-void TransformationFacade::generate(
- xalan::FormatterListener& formatter,
- const xalan::XObjectPtr& parameter
-) {
- StylesheetParameterGuard guard(this->transformer_);
- guard.set("parameters", parameter);
-
- this->generate(formatter);
-}
-
-void TransformationFacade::generate(xalan::FormatterListener& target) {
- ErrorCapacitor errorCapacitor(&this->error_multiplexer_);
-
- this->transformer_.transform(
- *(this->input_),
- this->transformation_,
- target
- );
-
- errorCapacitor.discharge();
-}
-
-}