Page 1 of 1

How to user XercesParser as my XMLSchema

Posted: Sun Mar 11, 2012 18:24
by Michael.Zhang
As the subject says.
I'm a beginner of CEGUI. Thank you for any help~
I downloaded CEGUI for 0.7.6. The default XMLSchema of it is ExpatParser.
But when I copy a demo from Internet, it uses XercesParser as XMLSchema.
When I run it, it need CEGUIXercesParser_d.lib. For I haven't compile CEGUIXercesParser, I can't compile the demo.
So I try to compile CEGUIXercesParser. I set up a new project in CEGUI and set the properties like other projects.
When I compile it, such error puzzled me.

Error 3 error C2491: 'CEGUI::XercesParser::d_defaultSchemaResourceGroup' : definition of dllimport static data member not allowed d:\cegui\cegui-0.7.6\cegui\src\xmlparsermodules\xercesparser\ceguixercesparser.cpp 45
Error 5 error C2491: 'CEGUI::XercesParser::s_schemaDefaultResourceGroupProperty' : definition of dllimport static data member not allowed d:\cegui\cegui-0.7.6\cegui\src\xmlparsermodules\xercesparser\ceguixercesparser.cpp 48
16 IntelliSense: cannot define dllimport entity d:\cegui\cegui-0.7.6\cegui\src\xmlparsermodules\xercesparser\ceguixercesparser.cpp 45
17 IntelliSense: cannot define dllimport entity d:\cegui\cegui-0.7.6\cegui\src\xmlparsermodules\xercesparser\ceguixercesparser.cpp 48
How can I compile it .
Or other method by ExpatParser instead of XercesParser method:
CEGUI::XMLParser* parser = CEGUI::System::getSingleton().getXMLParser();
if (parser->isPropertyPresent("SchemaDefaultResourceGroup"))
parser->setProperty("SchemaDefaultResourceGroup", "schemas");
Thanks for any help.

Re: How to user XercesParser as my XMLSchema

Posted: Sun Mar 11, 2012 21:37
by CrazyEddie
Hi,

Your post is completely confusing to me - to the point where I almost did not bother to reply :?

The code you posted towards the bottom is the 'right way' to deal with the set up in the face of any of the XMLParser modules - i.e. it is not xerces-c++ specific, and you should not need to link to the xerces parser lib (except if you are static linking). Some older code (for 0.6.x versions and earlier) used to link directly with the parser when using xerces, but by using the property based "test and set" you no longer need to worry about linking directly.

I'm confused by what you said about setting up a project. Do you mean for some other code or for the CEGUIXercesParser module? If you mean for the parser, then this is not the correct way to proceed. The right way is to enable the parser (and maybe set it as default) in config.lua and regenerate the projects using premake.

The compile errors might indicate some configuration issue, but I'm confused as to when these appear? Is it when building the CEGUIXercesParser project, or when building your own code? What is the configuration you are building?

CE

Re: How to user XercesParser as my XMLSchema

Posted: Tue Mar 13, 2012 03:59
by Michael.Zhang
Thank you for your explanation.
What you replied is exactly what I need and I have solved my problem.
Thanks~ :D