aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Kummerlaender2014-07-09 19:59:32 +0200
committerAdrian Kummerlaender2014-07-09 19:59:32 +0200
commit1fbf6a39784b57925ab19df579f487a338e22ba5 (patch)
treee3e6a9aaa9cf54cc5e294d7f03a02b450d30a5b8
parentfcc2f8ee41d6793411a2321e6b0ac46cb5ba23ee (diff)
downloadInputXSLT-1fbf6a39784b57925ab19df579f487a338e22ba5.tar
InputXSLT-1fbf6a39784b57925ab19df579f487a338e22ba5.tar.gz
InputXSLT-1fbf6a39784b57925ab19df579f487a338e22ba5.tar.bz2
InputXSLT-1fbf6a39784b57925ab19df579f487a338e22ba5.tar.lz
InputXSLT-1fbf6a39784b57925ab19df579f487a338e22ba5.tar.xz
InputXSLT-1fbf6a39784b57925ab19df579f487a338e22ba5.tar.zst
InputXSLT-1fbf6a39784b57925ab19df579f487a338e22ba5.zip
Added DomDocumentCache::createDocument overload enabling document naming
* previous createDocument method used default name "content" ** this led to problems when using xalan::XalanNode as transformation input ** the parameter-less createDocument overload now creates a unnamed xercesc::DOMDocument * changed external function implementations accordingly
-rw-r--r--src/function/external_text_formatter.cc2
-rw-r--r--src/function/read_directory.cc2
-rw-r--r--src/function/read_file.cc2
-rw-r--r--src/function/transform.cc2
-rw-r--r--src/function/write_file.cc2
-rw-r--r--src/support/dom/document_cache.cc8
-rw-r--r--src/support/dom/document_cache.h1
-rw-r--r--src/support/include_entity_resolver.cc2
8 files changed, 14 insertions, 7 deletions
diff --git a/src/function/external_text_formatter.cc b/src/function/external_text_formatter.cc
index de8a296..ccf7ee7 100644
--- a/src/function/external_text_formatter.cc
+++ b/src/function/external_text_formatter.cc
@@ -44,7 +44,7 @@ DomDocumentCache::document_ptr FunctionExternalTextFormatter::constructDocument(
std::string stdinText
) {
DomDocumentCache::document_ptr domDocument(
- DomDocumentCache::createDocument()
+ DomDocumentCache::createDocument("content")
);
boost::process::context context;
diff --git a/src/function/read_directory.cc b/src/function/read_directory.cc
index cbc64e0..9b84828 100644
--- a/src/function/read_directory.cc
+++ b/src/function/read_directory.cc
@@ -8,7 +8,7 @@ namespace InputXSLT {
DomDocumentCache::document_ptr FunctionReadDirectory::constructDocument(
boost::filesystem::path directoryPath) {
DomDocumentCache::document_ptr domDocument(
- DomDocumentCache::createDocument()
+ DomDocumentCache::createDocument("content")
);
ResultNodeFacade result(domDocument.get(), "directory");
diff --git a/src/function/read_file.cc b/src/function/read_file.cc
index dcd32b7..0ca5ee3 100644
--- a/src/function/read_file.cc
+++ b/src/function/read_file.cc
@@ -62,7 +62,7 @@ namespace InputXSLT {
DomDocumentCache::document_ptr FunctionReadFile::constructDocument(
boost::filesystem::path filePath) {
DomDocumentCache::document_ptr domDocument(
- DomDocumentCache::createDocument()
+ DomDocumentCache::createDocument("content")
);
ResultNodeFacade result(domDocument.get(), "file");
diff --git a/src/function/transform.cc b/src/function/transform.cc
index d7aae94..6cda7a7 100644
--- a/src/function/transform.cc
+++ b/src/function/transform.cc
@@ -31,7 +31,7 @@ DomDocumentCache::document_ptr FunctionTransform::constructDocument(
xalan::XSLTInputSource transformationSource
) {
DomDocumentCache::document_ptr domDocument(
- DomDocumentCache::createDocument()
+ DomDocumentCache::createDocument("content")
);
ResultNodeFacade result(domDocument.get(), "transformation");
diff --git a/src/function/write_file.cc b/src/function/write_file.cc
index 0ad68bf..3df9d78 100644
--- a/src/function/write_file.cc
+++ b/src/function/write_file.cc
@@ -62,7 +62,7 @@ DomDocumentCache::document_ptr FunctionWriteFile::constructDocument(
xalan::XalanNode* const contentNode
) {
DomDocumentCache::document_ptr domDocument(
- DomDocumentCache::createDocument()
+ DomDocumentCache::createDocument("content")
);
ResultNodeFacade result(domDocument.get(), "file");
diff --git a/src/support/dom/document_cache.cc b/src/support/dom/document_cache.cc
index 23805b5..c18bf96 100644
--- a/src/support/dom/document_cache.cc
+++ b/src/support/dom/document_cache.cc
@@ -11,9 +11,15 @@ namespace InputXSLT {
auto DomDocumentCache::createDocument() -> document_ptr {
return document_ptr(
+ xercesc::DOMImplementation::getImplementation()->createDocument()
+ );
+}
+
+auto DomDocumentCache::createDocument(const std::string& name) -> document_ptr {
+ return document_ptr(
xercesc::DOMImplementation::getImplementation()->createDocument(
nullptr,
- *XercesStringGuard<XMLCh>("content"),
+ *XercesStringGuard<XMLCh>(name),
nullptr
)
);
diff --git a/src/support/dom/document_cache.h b/src/support/dom/document_cache.h
index 3aeb332..f472249 100644
--- a/src/support/dom/document_cache.h
+++ b/src/support/dom/document_cache.h
@@ -27,6 +27,7 @@ class DomDocumentCache {
> document_ptr;
static document_ptr createDocument();
+ static document_ptr createDocument(const std::string&);
DomDocumentCache();
diff --git a/src/support/include_entity_resolver.cc b/src/support/include_entity_resolver.cc
index 818d307..b9e20f9 100644
--- a/src/support/include_entity_resolver.cc
+++ b/src/support/include_entity_resolver.cc
@@ -21,7 +21,7 @@ boost::optional<boost::filesystem::path> extractFilePath(
boost::filesystem::path(
rawPath.substr(
leadingDelimiter + 1,
- closingDelimiter - leadingDelimiter - 1
+ closingDelimiter - 1 - leadingDelimiter
)
)
);