kuba m wrote:
hello, I am using Linux - Ubuntu, I downloaded Xerces-C++ 2.7.0 and
Xalan-C++ 1.10.0 binaries, followed the instructions on the website
and managed to build both, I can run Xalan from the command line - so
this means that it built fine, doesn't it ?
If you downloaded the binaries, you don't need to build anything. You
only need to build if you download the source distributions.
However there is a problem if I want to compile some sample c++ code
that uses Xalan. I followed the instructions on this website :
http://rudeserver.com/xalan/
I try to compile the test.cpp file from that site,this way :
g++ -o test -I /home/halski/parsery/xml-xalan/c/src/xalanc/ -I
/home/halski/parsery/xerces-c-src_2_7_0/include/
/home/halski/parsery/xerces-c-src_2_7_0/ test.cpp
/usr/lib/libxalan-c.so /usr/lib/libxerces-c.so
and I am getting this :
test.cpp: In function ‘int main()’:
test.cpp:20: error: ‘XMLPlatformUtils’ has not been declared
test.cpp:20: error: ‘Initialize’ was not declared in this scope
test.cpp:21: error: ‘XalanTransformer’ has not been declared
test.cpp:21: error: ‘initialize’ was not declared in this scope
test.cpp:24: error: ‘XalanTransformer’ was not declared
in this scope
test.cpp:24: error: expected `;' before ‘theXalanTransformer’
test.cpp:27: error: ‘XSLTInputSource’ was not declared in
this scope
test.cpp:27: error: expected `;' before ‘xmlIn’
test.cpp:28: error: expected `;' before ‘xslIn’
test.cpp:29: error: ‘XSLTResultTarget’ was not declared
in this scope
test.cpp:29: error: expected `;' before ‘xmlOut’
test.cpp:33: error: ‘theXalanTransformer’ was not
declared in this scope
test.cpp:33: error: ‘xmlIn’ was not declared in this scope
test.cpp:33: error: ‘xslIn’ was not declared in this scope
test.cpp:33: error: ‘xmlOut’ was not declared in this scope
test.cpp:39: error: ‘XalanTransformer’ is not a class or namespace
test.cpp:40: error: ‘XMLPlatformUtils’ has not been declared
test.cpp:40: error: ‘Terminate’ was not declared in this scope
test.cpp:41: error: ‘XalanTransformer’ is not a class or namespace
test.cpp:41: error: ‘ICUCleanUp’ was not declared in this scope
Did you take a look at the sample programs? It's hard to say what might
be wrong since you didn't post any source code, but it's probably an
issue with C++ namespaces. If you look at one of the sample programs,
you will see lines of code like this:
XALAN_USING_XERCES(XMLPlatformUtils)
XALAN_USING_XALAN(XalanTransformer)
These are macros that wrap the C++ using directive, which brings a name
into the current scope. Alternately, you can do the following:
xercesc::XMLPlatformUtils::Initialize();
and:
xalanc::XalanTransformer::initialize();
Dave