I assume you generating your xml file with some C code, using the fprintf command. Correct ?
If so adding then \n at the end of the line ought to work. It is probably a compiler option that causes the incorrect line ends.
To circumvent the problem you can add proper line ends this way (this is instead of \n):
Windows: \x0D\x0A
Unix: \x0A
Macintosh: \x0D
What this does is add one or two characters. It is just spelled out in hexadecimal. x0D = 13 decimal = Carriage Return and x0A = 10 decimal = Line Feed
XML bug
This is from CXMLWriter.cpp
And this is from my writer to string class
I think I can make this work lend a hand if you can please and thanks.
Code: Select all
//! Writes a line break
void CXMLWriter::writeLineBreak()
{
if (!File)
return;
File->write("\n", 2);
}
Code: Select all
//! Writes a line break
void CXMLWriterToString::writeLineBreak()
{
str += "\n";
}
Brilliant I "Think" it's working but there is no way to tell until I write to a file to see if it actually breaks the line.evo wrote:I assume you generating your xml file with some C code, using the fprintf command. Correct ?
If so adding then \n at the end of the line ought to work. It is probably a compiler option that causes the incorrect line ends.
To circumvent the problem you can add proper line ends this way (this is instead of \n):
Windows: \x0D\x0A
Unix: \x0A
Macintosh: \x0D
What this does is add one or two characters. It is just spelled out in hexadecimal. x0D = 13 decimal = Carriage Return and x0A = 10 decimal = Line Feed
I'll get back on that.
Ok. I have tried a couple of things and could this be a bug in XMLwriter?
In CXMLWriter.cpp: writeLineBreak sends 2 characters to be written to file.
File->write issues a normal fwrite in CWriteFile.cpp
When I try this out in DevC / WinXP, this causes an extra zero character to be written to the file after the CR/LF. When I use File->write("\n", 1) everything works perfectly.
To solve the problem I guess you need to change the code of CXMLWriter.cpp. I am not sure if this is a platform independant solution.
In CXMLWriter.cpp: writeLineBreak sends 2 characters to be written to file.
Code: Select all
//! Writes a line break
void CXMLWriter::writeLineBreak()
{
if (!File)
return;
File->write("\n", 2);
}
File->write issues a normal fwrite in CWriteFile.cpp
When I try this out in DevC / WinXP, this causes an extra zero character to be written to the file after the CR/LF. When I use File->write("\n", 1) everything works perfectly.
To solve the problem I guess you need to change the code of CXMLWriter.cpp. I am not sure if this is a platform independant solution.
Last edited by evo on Wed Aug 10, 2005 10:28 am, edited 1 time in total.
I havent actually used the writer yet... I'm using writer to string.
I don't know how to recompile the engine yet.
I have however solved my problem..well sorta.
I'm taking a new direction I'm going to write a simple string class to store the list undo and redo functions for guice.
I'll still use xml for the configuration though or possibly the earlier example
and go without xml all together.
this is much more complicated then it was ment to be and irrlicht has a lot of bugs I think.
I don't know how to recompile the engine yet.
I have however solved my problem..well sorta.
I'm taking a new direction I'm going to write a simple string class to store the list undo and redo functions for guice.
I'll still use xml for the configuration though or possibly the earlier example
and go without xml all together.
this is much more complicated then it was ment to be and irrlicht has a lot of bugs I think.
so your plan is to make a new message??Masdus wrote:It would probably be best if you just start a new post in the bug section stating the exact problem so Niko doesn't have to look through multiple messages to get to the problem
whatever anyone that is active on the board should know whats where and what not... this isn't a bug report guys it's more of a personal problem.
And it's outlived it's usefulness it may as well be deleted but your "please move" posts just bump it.