diff options
Diffstat (limited to 'src/transformer_facade.cc')
-rw-r--r-- | src/transformer_facade.cc | 74 |
1 files changed, 0 insertions, 74 deletions
diff --git a/src/transformer_facade.cc b/src/transformer_facade.cc deleted file mode 100644 index fbf604c..0000000 --- a/src/transformer_facade.cc +++ /dev/null @@ -1,74 +0,0 @@ -#include "transformer_facade.h" - -#include <xalanc/XSLT/XSLTInputSource.hpp> -#include <xalanc/XalanTransformer/XalanTransformer.hpp> -#include <xalanc/XercesParserLiaison/XercesDOMSupport.hpp> -#include <xalanc/XalanTransformer/XercesDOMWrapperParsedSource.hpp> - -#include <xercesc/dom/DOMDocument.hpp> -#include <xercesc/dom/DOMImplementation.hpp> - -#include <iostream> - -#include "function/read_file.h" -#include "function/read_xml_file.h" -#include "function/read_directory.h" - - -namespace InputXSLT { - -TransformerFacade::TransformerFacade(const std::string& path): - fs_context_(path), - parser_(), - transformer_() { - const xalan::XalanDOMString customNamespace( - "http://ExternalFunction.xalan-c++.xml.apache.org" - ); - - this->transformer_.installExternalFunction( - customNamespace, - xalan::XalanDOMString("read-file"), - InputXSLT::FunctionReadFile(this->fs_context_) - ); - - this->transformer_.installExternalFunction( - customNamespace, - xalan::XalanDOMString("read-xml-file"), - InputXSLT::FunctionReadXmlFile(this->fs_context_) - ); - - this->transformer_.installExternalFunction( - customNamespace, - xalan::XalanDOMString("read-directory"), - InputXSLT::FunctionReadDirectory(this->fs_context_) - ); -} - -int TransformerFacade::execute( - const std::string& transformation, - const std::string& target -) { - xercesc::DOMDocument* inputDom( - xercesc::DOMImplementation::getImplementation()->createDocument() - ); - xalan::XercesDOMSupport domSupport(this->parser_); - - xalan::XercesDOMWrapperParsedSource parsedInput( - inputDom, - this->parser_, - domSupport - ); - - inputDom->release(); - - xalan::XSLTInputSource transform(transformation.data()); - xalan::XSLTResultTarget output(target.data()); - - return this->transformer_.transform( - parsedInput, - transform, - output - ); -} - -} |