Hi, I'm new to xerces-c, I'm able to build the lib, dll, and sample
applications with the coming in solution/project files with Visual
Studio 2005.
However, when I try to use SAXparser in my application, I got compiler
errors as following. We use Visual Studio 2005 C++ compiler.
Thanks advance for your helps.
Tony
cl -I. -I.././IDL -I.././Infrastructure -I.././DB -I.././model
-Ic:\dev
\iona\include -Ic:\dev\versant\7_0_1\h -Ic:\dev\SourcePro
-I.././thirdparty/zlib
/include -IC:\dev\xerces_2_8_0\xerces-c-src_2_8_0/src -nologo -W3 -GR
-EHsc -vmg
-Od -FD -EHsc -MD -Zi -Zm200 -DWIN32 -DCONSOLE -DPLATFORM_WIN32
-D_VC80_UPGRADE
=0x0710 -D_WINDOWS -DXML_USE_WIN32_TRANSCODER -DXML_USE_WIN32_MSGLOADER
-DXML_US
E_NETACCESSOR_WINSOCK -D_CRT_SECURE_NO_DEPRECATE -D_CRTDBG_MAP_ALLOC
-DWIN32_LEA
N_AND_MEAN -DVERSANT_ANSI -D_CRT_SECURE_NO_DEPRECATE -D_AFXDLL -DNDEBUG
-DIT_U
SE_STD_IOSTREAM -DORBIX_DLL -D_RWCONFIG=12d -D_CONSOLE
-DN_VERSANT_SUPPORT /Y
u"StdAfx.h" -c NCodianBridgeServer.cpp
NCodianBridgeServer.cpp
C:\dev\xerces_2_8_0\xerces-c-src_2_8_0\src\xercesc/util/regx/Op.hpp(50)
: error
C2143: syntax error : missing '}' before 'constant'
C:\dev\xerces_2_8_0\xerces-c-src_2_8_0\src\xercesc/util/regx/Op.hpp(50)
: error
C2059: syntax error : 'constant'
C:\dev\xerces_2_8_0\xerces-c-src_2_8_0\src\xercesc/util/regx/Op.hpp(64)
: error
C2143: syntax error : missing ';' before '}'
* More --
Here is NCodianBridgeServer.cpp
//XERCES_CPP_NAMESPACE_BEGIN
#include <xercesc/util/PlatformUtils.hpp>
#include <xercesc/parsers/SAXParser.hpp>
#include <xercesc/framework/MemBufInputSource.hpp>
#include <xercesc/util/OutOfMemoryException.hpp>
//XERCES_CPP_NAMESPACE_END
// Get the input and output object stream declarations
#include <rw/http/RWHttpReply.h>
#include <rw/itc/RWTIOUResult.h>
#include <rw/internet/RWURL.h>
#include <rw/http/RWHttpRequestStringBody.h>
#include <rw/xmlabstractions/RWXmlReader.h>
#include <rw/http/RWHttpGenericHeader.h>
#include <rw/http/RWHttpContentTypeHeader.h>
#include <rw/http/RWHttpDate.h>
//PolycomAPI includes
#include "NMeetingStructs.hh"
#include <simpletypelist.h>
//Please insert other includes above this line
#include "NCodianBridgeServer.h"
#include "NCodianAPIHelper.h"
#include "NGlobalFuncs.h"
#define CUST_NAME_LENGTH 15
XERCES_CPP_NAMESPACE_USE
bool
NCodianBridgeServer::parseResponse(const NString & response,
NCodianRespParseHandler & parseHandler)
{
const char * kFuncName = "NCodianBridgeServer::parseResponse";
FUNCLOG(LOG_NPOLYCOMBRIDGESERVICEIMPL, kFuncName, ">>>" );
const char* gMemBufId = "prodInfo";
// Initialize the XML4C2 system
try
{
XMLPlatformUtils::Initialize();
}
catch (const XMLException& toCatch)
{
XERCES_STD_QUALIFIER cerr << "Error during initialization!
Message:\n"
<< StrX(toCatch.getMessage()) << XERCES_STD_QUALIFIER
endl;
return false;
}
SAXParser::ValSchemes valScheme = SAXParser::Val_Auto;
bool doNamespaces = false;
bool doSchema = false;
bool schemaFullChecking = false;
// Create a SAX parser object. Then, according to what we were told
on
// the command line, set it to validate or not.
//
SAXParser* parser = new SAXParser();
parser->setValidationScheme(valScheme);
parser->setDoNamespaces(doNamespaces);
parser->setDoSchema(doSchema);
parser->setValidationSchemaFullChecking(schemaFullChecking);
//
// Create our SAX handler object and install it on the parser, as
the
// document and error handlers.
//
parser->setDocumentHandler(&parseHandler);
parser->setErrorHandler(&parseHandler);
//
// Create MemBufferInputSource from the buffer containing the XML
// statements.
//
MemBufInputSource* memBufIS = new MemBufInputSource
(
(const XMLByte*) response
, response.size()
, gMemBufId
, false
);
//start parsing
unsigned int errorCode = 0;
try
{
parser->parse(*memBufIS);
}
catch (const OutOfMemoryException&)
{
XERCES_STD_QUALIFIER cerr << "OutOfMemoryException" <<
XERCES_STD_QUALIFIER endl;
errorCode = 5;
}
catch (const XMLException& e)
{
XERCES_STD_QUALIFIER cerr << "\nError during parsing memory
stream:\n"
<< "Exception message is: \n"
<< StrX(e.getMessage()) << "\n" << XERCES_STD_QUALIFIER
endl;
errorCode = 4;
}
//
// Delete the parser itself. Must be done prior to calling
Terminate, below.
//
delete parser;
delete memBufIS;
// And call the termination method
XMLPlatformUtils::Terminate();
if(errorCode) {
return false;
}
return true;
}