Unable to load scheme

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

User avatar
BradDaBug
Not too shy to talk
Not too shy to talk
Posts: 23
Joined: Sat Apr 09, 2005 00:56

Unable to load scheme

Postby BradDaBug » Tue Feb 28, 2006 02:52

Whenever I try to load a scheme the program aborts. Here's the last few lines of the log file:

27/02/2006 20:02:56 (InfL1) Attempting to load Scheme from file '../datafiles/schemes/WindowsLook.scheme'.
27/02/2006 20:02:56 (Error) Exception: Scheme::xmlHandler::startElement - Unexpected data was found while parsing the Scheme file: '' is unknown.
27/02/2006 20:02:56 (Error) Scheme::Scheme - loading of Scheme from file '../datafiles/schemes/WindowsLook.scheme' failed.

I've got another simple project that loads the same schemes fine. As far as I can tell everything is the same for both projects, directory layout, scheme loading code, etc.

Also, Valgrind reports for both projects some invalid reads inside SchemeManager::loadScheme(), specifically down in TiXmlDocument::Parse() (tinyxmlparser.cpp:756), which calls TiXmlBase::SkipWhiteSpace() (tinyxmlparser.cpp:337). I'm not sure if they're related or not.

Any ideas?

User avatar
martignasse
Just can't stay away
Just can't stay away
Posts: 227
Joined: Thu Apr 14, 2005 08:10
Location: Lyon, FRANCE

Postby martignasse » Tue Feb 28, 2006 09:43

hi BradDaBug,

seem's like you'r xml file (scheme) is corrupted, can you post it, please.

You should use Xerces how can validate you'r xml file and is more explicit if fond errors.

hope it help

User avatar
martignasse
Just can't stay away
Just can't stay away
Posts: 227
Joined: Thu Apr 14, 2005 08:10
Location: Lyon, FRANCE

Postby martignasse » Tue Feb 28, 2006 09:43

hi BradDaBug,

seem's like you'r xml file (scheme) is corrupted, can you post it, please.

You should use Xerces how can validate you'r xml file and is more explicit if fond errors.

hope it help

User avatar
BradDaBug
Not too shy to talk
Not too shy to talk
Posts: 23
Joined: Sat Apr 09, 2005 00:56

Postby BradDaBug » Tue Feb 28, 2006 21:46

Here's the scheme I'm trying to load:

Code: Select all

<?xml version="1.0" ?>
<GUIScheme Name="WindowsLook">
   <Imageset Name="WindowsLook" Filename="../datafiles/imagesets/WindowsLook.imageset" />
   <WindowSet Filename="CEGUIWindowsLook" />
</GUIScheme>

User avatar
martignasse
Just can't stay away
Just can't stay away
Posts: 227
Joined: Thu Apr 14, 2005 08:10
Location: Lyon, FRANCE

Postby martignasse » Wed Mar 01, 2006 10:42

You'r scheme seem's ok, apparently.

But because you related TiXmlBase::SkipWhiteSpace() problems,
i looked more deeply and discover that you have an extra space caractere at the end of each lines, maybe it's that...

could be good to test whit xerces to see if the error occur and to validate you'r xml files.

hope it help.

User avatar
BradDaBug
Not too shy to talk
Not too shy to talk
Posts: 23
Joined: Sat Apr 09, 2005 00:56

Postby BradDaBug » Wed Mar 01, 2006 15:12

I'll have to test with Xerces later since I'm not at my computer.

If it is a problem with the spaces at the end of the lines, wouldn't that be a bug in TinyXML?

User avatar
BradDaBug
Not too shy to talk
Not too shy to talk
Posts: 23
Joined: Sat Apr 09, 2005 00:56

Postby BradDaBug » Thu Mar 02, 2006 01:34

Removing the spaces at the end of the lines did nothing.

User avatar
BradDaBug
Not too shy to talk
Not too shy to talk
Posts: 23
Joined: Sat Apr 09, 2005 00:56

Postby BradDaBug » Thu Mar 02, 2006 03:08

I rebuilt CEGUI using xerces and it worked fine. Then I built it again disabling xerces and using tinyxml and the problem is still there.

User avatar
martignasse
Just can't stay away
Just can't stay away
Posts: 227
Joined: Thu Apr 14, 2005 08:10
Location: Lyon, FRANCE

Postby martignasse » Thu Mar 02, 2006 09:20

I rebuilt CEGUI using xerces and it worked fine. Then I built it again disabling xerces and using tinyxml and the problem is still there.
Ok, at least, you can continu to work :)

So, the problem is in the tinyXml code.

did you modify it ?
are you on windows of linux ?

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

Postby CrazyEddie » Thu Mar 02, 2006 10:15

Do you have a blank like at the end of the scheme file? If not, does it help if you add one?

There is a potential issue in the TinyXML usage, you might be seeing this. Also, which version of the code are you using?

CE

User avatar
BradDaBug
Not too shy to talk
Not too shy to talk
Posts: 23
Joined: Sat Apr 09, 2005 00:56

Postby BradDaBug » Thu Mar 02, 2006 16:07

If you're talking about the null termination issue, I don't think that's it (I was discussing this with lindquist on irc last night) because I created a custom resource provider and added an extra null byte at the end of the buffer that I'm giving to tinyxml and that didn't do anything except fix one of the 1 byte read errors that valgrind was reporting.

I haven't edited TinyXML, and I'm on Linux.

I did some debugging last night and it looks like some strings are being corrupted. For instance, the GUIScheme attribute "Name" should have had a value of "TaharezLook", but it looked like it was being passed around as just "ook", and the address of the pointer was set 8 bytes ahead of where it should have been.

User avatar
BradDaBug
Not too shy to talk
Not too shy to talk
Posts: 23
Joined: Sat Apr 09, 2005 00:56

Postby BradDaBug » Fri Mar 03, 2006 06:14

It looks like that when a string is being passed to attrs.add() inside TinyXMLDocument::processElement() it's being cast wrong, since the String is being constructed with "ook" instead of "TaharezLook". At least thats the way it looks to me; there might be a reasonable explanation for that and it's not a problem at all.

I don't see why it would be a casting problem, since TinyXML is returing a char* and it's being cast as a utf8* prior to being sent to the String constructor, and utf8* is just a uint8* typedef.

User avatar
BradDaBug
Not too shy to talk
Not too shy to talk
Posts: 23
Joined: Sat Apr 09, 2005 00:56

Postby BradDaBug » Sat Mar 04, 2006 04:25

I can get TinyXML to work. I downloaded the latest version and copied that into the tinyxml directory of the source, edited tinyxml.h and added #define TIXML_USE_STL, and build CEGUI. Once I do that everything works and valgrind is happy. I haven't tried enabling STL in the version of tinyxml that comes with 0.4.1 of CEGUI by default.

So, what does this mean? TinyXML has a bug?

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

Postby CrazyEddie » Sun Mar 05, 2006 15:57

Hi

It's certainly possible that there's a bug in our TinyXML version, though I have not encountered the issue.

In the next release we will be doing away with as many of the embedded copies of libs as possible in order to facilitate better updating and 'sharing' of these libs.

CE.


Return to “Help”

Who is online

Users browsing this forum: No registered users and 16 guests