Once you install xerces in [YOUR_XERCES_PATH], you have to settle a few values in your project property pages:
Among C/C++, General, Additional Include Directories: [YOUR_XERCES_PATH]\include
In Linker, General, Additional Library Directories: [YOUR_XERCES_PATH]\lib
In Linker, Input, Additional Dependencies: xerces-c_3.lib
And, xerces-c_3_1.dll should available to the application you are going to write. You could easily achieve this adding [YOUR_XERCES_PATH]\bin to your system PATH.
Once you have done all of this, you are ready for your first Xerces application, as reported by the minimal official Xerces C++ 3.1.1 Programming Guide.
It is the bit of code that any application designed to use Xerces has to implement, and it just initializes and terminates the Xerces system:
#include <iostream>
#include <xercesc/util/PlatformUtils.hpp>
XERCES_CPP_NAMESPACE_USE
int main(int argc, char* argv[])
{
std::cout << "Initializing Xerces" << std::endl;
try
{
XMLPlatformUtils::Initialize();
}
catch(const XMLException& toCatch)
{
std::cout << "Failure on Xerces: " << toCatch.getMessage() << std::endl;
return 1;
}
// Do your actual work with Xerces-C++ here.
std::cout << "Terminating Xerces" << std::endl;
XMLPlatformUtils::Terminate();
system("pause");
return 0;
}
No comments:
Post a Comment