From 334efe3383c436d61a8e5dd95b923cb0d5db9652 Mon Sep 17 00:00:00 2001 From: Adrian Kummerländer Date: Sat, 19 Apr 2014 15:01:33 +0200 Subject: Further code style fixes * .. in the face of the planned development of usable external functions using the current proof-of-concept coding * replaced usage of std::shared_ptr in FunctionReadXmlFile class with explicit implementation of default and copy constructor * separated implementation and interfaces --- src/function/read_xml_file.cc | 44 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 src/function/read_xml_file.cc (limited to 'src/function/read_xml_file.cc') diff --git a/src/function/read_xml_file.cc b/src/function/read_xml_file.cc new file mode 100644 index 0000000..616d189 --- /dev/null +++ b/src/function/read_xml_file.cc @@ -0,0 +1,44 @@ +#include "read_xml_file.h" + +namespace InputXSLT { + +FunctionReadXmlFile::FunctionReadXmlFile(): + parser_() { } + +FunctionReadXmlFile::FunctionReadXmlFile(const FunctionReadXmlFile&): + parser_() { } + +xalan::XObjectPtr FunctionReadXmlFile::execute( + xalan::XPathExecutionContext& executionContext, + xalan::XalanNode* context, + const xalan::Function::XObjectArgVectorType& arguments, + const xalan::Locator* locator +) const { + if ( arguments.size() != 1 ) { + xalan::XPathExecutionContext::GetAndReleaseCachedString guard( + executionContext + ); + + generalError(executionContext, context, locator); + } + + return executionContext.getXObjectFactory().createNodeSet( + this->parser_.parseXMLStream( + xalan::XSLTInputSource(arguments[0]->str()) + ) + ); +} + +FunctionReadXmlFile* FunctionReadXmlFile::clone( + xalan::MemoryManager& manager) const { + return xalan::XalanCopyConstruct(manager, *this); +} + +const xalan::XalanDOMString& FunctionReadXmlFile::getError( + xalan::XalanDOMString& result) const { + result.assign("The read-xml-file() function expects one argument."); + + return result; +} + +} -- cgit v1.2.3