aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/read_file_command.h43
-rw-r--r--test.cc16
2 files changed, 30 insertions, 29 deletions
diff --git a/src/read_file_command.h b/src/read_file_command.h
index 88c20bf..094bb3d 100644
--- a/src/read_file_command.h
+++ b/src/read_file_command.h
@@ -3,51 +3,52 @@
#include <xalanc/XalanTransformer/XalanTransformer.hpp>
#include <xalanc/XPath/XObjectFactory.hpp>
#include <xalanc/XPath/Function.hpp>
+#include <xalanc/XPath/XObject.hpp>
#include "utility.h"
-XALAN_USING_XALAN(Function)
-XALAN_USING_XALAN(Locator)
-XALAN_USING_XALAN(XPathExecutionContext)
-XALAN_USING_XALAN(XalanDOMString)
-XALAN_USING_XALAN(XalanNode)
-XALAN_USING_XALAN(XObjectPtr)
-XALAN_USING_XALAN(MemoryManager)
-XALAN_USING_XALAN(XalanCopyConstruct)
+namespace xalan = xalanc_1_11;
-class FunctionFileRead : public Function {
+class FunctionFileRead : public xalan::Function {
public:
- virtual XObjectPtr execute(
- XPathExecutionContext& executionContext,
- XalanNode* context,
- const XObjectArgVectorType& args,
- const Locator* locator
+ virtual xalan::XObjectPtr execute(
+ xalan::XPathExecutionContext& executionContext,
+ xalan::XalanNode* context,
+ const xalan::Function::XObjectArgVectorType& args,
+ const xalan::Locator* locator
) const {
if ( args.size() != 1 ) {
- XPathExecutionContext::GetAndReleaseCachedString guard(executionContext);
+ xalan::XPathExecutionContext::GetAndReleaseCachedString guard(
+ executionContext
+ );
generalError(executionContext, context, locator);
}
- xalanc_1_11::CharVectorType tmpFileName;
+ xalan::CharVectorType tmpFileName;
std::string fileName;
args[0]->str().transcode(tmpFileName);
- std::move(tmpFileName.begin(), tmpFileName.end(), fileName.begin());
+
+ std::move(
+ tmpFileName.begin(),
+ tmpFileName.end(),
+ fileName.begin()
+ );
std::string content(readFile(fileName));
return executionContext.getXObjectFactory().createString(
- XalanDOMString(content.data())
+ xalan::XalanDOMString(content.data())
);
}
- virtual FunctionFileRead* clone(MemoryManager& manager) const {
- return XalanCopyConstruct(manager, *this);
+ virtual FunctionFileRead* clone(xalan::MemoryManager& manager) const {
+ return xalan::XalanCopyConstruct(manager, *this);
}
protected:
- const XalanDOMString& getError(XalanDOMString& result) const {
+ const xalan::XalanDOMString& getError(xalan::XalanDOMString& result) const {
result.assign("The read-file() function expects one argument.");
return result;
diff --git a/test.cc b/test.cc
index c922abf..39e591a 100644
--- a/test.cc
+++ b/test.cc
@@ -7,23 +7,23 @@
int main() {
xercesc::XMLPlatformUtils::Initialize();
- xalanc_1_11::XalanTransformer::initialize();
+ xalan::XalanTransformer::initialize();
- const xalanc_1_11::XalanDOMString customNamespace(
+ const xalan::XalanDOMString customNamespace(
"http://ExternalFunction.xalan-c++.xml.apache.org"
);
- xalanc_1_11::XalanTransformer transformer;
+ xalan::XalanTransformer transformer;
transformer.installExternalFunction(
customNamespace,
- xalanc_1_11::XalanDOMString("read-file"),
+ xalan::XalanDOMString("read-file"),
FunctionFileRead()
);
- xalanc_1_11::XSLTInputSource input("dummy/in.xml");
- xalanc_1_11::XSLTInputSource tranformation("dummy/transform.xsl");
- xalanc_1_11::XSLTResultTarget output("dummy/out.xml");
+ xalan::XSLTInputSource input("dummy/in.xml");
+ xalan::XSLTInputSource tranformation("dummy/transform.xsl");
+ xalan::XSLTResultTarget output("dummy/out.xml");
int result(transformer.transform(
input,
@@ -31,7 +31,7 @@ int main() {
output
));
- xalanc_1_11::XalanTransformer::terminate();
+ xalan::XalanTransformer::terminate();
return result;
}