aboutsummaryrefslogtreecommitdiff
path: root/src/function/read_xml_file.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/function/read_xml_file.cc')
-rw-r--r--src/function/read_xml_file.cc27
1 files changed, 19 insertions, 8 deletions
diff --git a/src/function/read_xml_file.cc b/src/function/read_xml_file.cc
index 7b54732..bf9ec2e 100644
--- a/src/function/read_xml_file.cc
+++ b/src/function/read_xml_file.cc
@@ -10,6 +10,24 @@
#include "support/xerces_string_guard.h"
+namespace {
+
+inline xercesc::DOMNode* importDocumentElement(
+ const boost::filesystem::path& filePath,
+ xercesc::DOMDocument* const domDocument
+) {
+ xercesc::XercesDOMParser parser;
+ boost::filesystem::ifstream file(filePath);
+ parser.parse(xalan::XSLTInputSource(file));
+
+ return domDocument->importNode(
+ parser.getDocument()->getDocumentElement(),
+ true
+ );
+}
+
+}
+
namespace InputXSLT {
FunctionReadXmlFile::FunctionReadXmlFile(const FilesystemContext& context):
@@ -49,15 +67,8 @@ xalan::XObjectPtr FunctionReadXmlFile::execute(
*XercesStringGuard(filePath.filename().string())
);
- xercesc::XercesDOMParser parser;
- boost::filesystem::ifstream file(filePath);
- parser.parse(xalan::XSLTInputSource(file));
-
xercesc::DOMNode* const resultTreeNode(
- domDocument->importNode(
- parser.getDocument()->getDocumentElement(),
- true
- )
+ importDocumentElement(filePath, domDocument)
);
resultNode->appendChild(resultTreeNode);