Hi Lydia,
At 03:20 PM 5/11/2006 +0000, Lydia wrote:
Hi,
can anybody help me with this?
I want to parse an XML document using XercesDOMParser. I built Xerces-2-7-0
with Visual Studio 2005 (with just some warnings).
I tried to use XercesDOMParser* and XercesDOMParser.
In the first case I get some linker errors concerning AbstractDOMParser:
------------------------------------------------------------------------
code:
XMLPlatformUtils::Initialize();
XercesDOMParser *parser = new XercesDOMParser();
XMLPlatformUtils::Terminate();
linker errors (unresolved external symbols): (only some of them ...)
public: virtual void __thiscall xercesc_2_7::AbstractDOMParser::docCharacters
(unsigned short const * const,unsigned int,bool)
public: virtual void __thiscall xercesc_2_7::AbstractDOMParser::docComment
(unsigned short const * const)
public: virtual void __thiscall
xercesc_2_7::AbstractDOMParser::docPI(unsigned
short const * const,unsigned short const * const)
public: virtual void __thiscall xercesc_2_7::AbstractDOMParser::endElement
(class xercesc_2_7::XMLElementDecl const &,unsigned int,bool,unsigned short
const * const)
public: virtual void __thiscall
xercesc_2_7::AbstractDOMParser::ignorableWhitespace(unsigned short const *
const,unsigned int,bool)
The fact that the missing symbols all list "unsigned short*" instead
of "wchar_t*" makes me think that you have set the option "Treat
wchar_t as a builtin type" to "No", while Xerces had it set to "Yes".
Aligning your project (or Xerces, if you really need that option to
be "No") to have the same value will fix the problem.
In the second case
------------------
code:
XMLPlatformUtils::Initialize();
XercesDOMParser parser;
XMLPlatformUtils::Terminate();
the code compiles fine but the application crashes with an access
violation in
DOMDocumentImpl::deleteHeap() [in line fMemoryManager->deallocate
(fCurrentBlock);] when trying to delete the parser object at the end.
XMLPlatformUtils::Terminate() must be called after all the
Xerces-managed objects have been deleted, or their destructors will
try to access global objects that Terminate deleted. For instance
XMLPlatformUtils::Initialize();
{
XercesDOMParser parser;
}
XMLPlatformUtils::Terminate();
or
XMLPlatformUtils::Initialize();
XercesDOMParser *parser = new XercesDOMParser();
delete parser;
XMLPlatformUtils::Terminate();
Hope this helps,
Alberto
Each hint is highly welcome.
Many thanks in advance,
Lydia.