How to user XercesParser as my XMLSchema

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

Michael.Zhang
Just popping in
Just popping in
Posts: 9
Joined: Sun Mar 11, 2012 18:14

How to user XercesParser as my XMLSchema

Postby Michael.Zhang » Sun Mar 11, 2012 18:24

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.

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: How to user XercesParser as my XMLSchema

Postby CrazyEddie » Sun Mar 11, 2012 21:37

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

Michael.Zhang
Just popping in
Just popping in
Posts: 9
Joined: Sun Mar 11, 2012 18:14

Re: How to user XercesParser as my XMLSchema

Postby Michael.Zhang » Tue Mar 13, 2012 03:59

Thank you for your explanation.
What you replied is exactly what I need and I have solved my problem.
Thanks~ :D


Return to “Help”

Who is online

Users browsing this forum: No registered users and 10 guests