diff options
Diffstat (limited to 'src/function/read_xml_file.cc')
| -rw-r--r-- | src/function/read_xml_file.cc | 63 | 
1 files changed, 6 insertions, 57 deletions
diff --git a/src/function/read_xml_file.cc b/src/function/read_xml_file.cc index a4e3e3c..71ba819 100644 --- a/src/function/read_xml_file.cc +++ b/src/function/read_xml_file.cc @@ -9,7 +9,6 @@  #include "boost/filesystem/fstream.hpp"  #include "support/xerces_string_guard.h" -#include "support/filesystem_context.h"  namespace { @@ -29,7 +28,12 @@ inline xercesc::DOMNode* importDocumentElement(  	);  } -xercesc::DOMDocument* constructDocument( +} + +namespace InputXSLT { + +xercesc::DOMDocument* FunctionReadXmlFile::constructDocument( +	const FilesystemContext&,  	const boost::filesystem::path& filePath  ) {  	xercesc::DOMDocument* const domDocument( @@ -72,58 +76,3 @@ xercesc::DOMDocument* constructDocument(  }  } - -namespace InputXSLT { - -FunctionReadXmlFile::FunctionReadXmlFile(): -	document_cache_(std::make_shared<DomDocumentCache>()) { } - -xalan::XObjectPtr FunctionReadXmlFile::execute( -	xalan::XPathExecutionContext& executionContext, -	xalan::XalanNode*, -	const xalan::XObjectPtr argument, -	const xalan::Locator* locator -) const { -	const FilesystemContext fsContext(locator); - -	const boost::filesystem::path filePath( -		fsContext.resolve(argument->str()) -	); - -	DomDocumentCache::optional_item optionalCachedDocument( -		this->document_cache_->get(filePath.string()) -	); - -	if ( !optionalCachedDocument.first ) { -		optionalCachedDocument = this->document_cache_->create( -			filePath.string(), -			constructDocument(filePath) -		); -	} - -	xalan::XPathExecutionContext::BorrowReturnMutableNodeRefList nodeList( -		executionContext -	); - -	nodeList->addNodes( -		*optionalCachedDocument.second->getXalanDocument() -		                              ->getDocumentElement() -		                              ->getChildNodes() -	); - -	return executionContext.getXObjectFactory().createNodeSet(nodeList); -} - -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 of type string."); - -	return result; -} - -}  | 
