QT XML serialization adds extra characters

Ayla

New Member
I have a method serializing a free text input into an XML node using QT. This text may contain newline characters. The problem is that when I serialize this text and deserializa it again, a few extra newline characters are getting inserted in the output stream. This is my serialization method:\[code\]QDomElement textElement = doc.createElement("Sql");QDomText cdata = http://stackoverflow.com/questions/11205856/doc.createTextNode(m_sql);textElement.appendChild(cdata);\[/code\]This is the text I want to serialize:\[code\]CREATE FUNCTION func(a INT) RETURNS INTBEGIN return 1;END\[/code\]This is what I get in the serialized file:\[quote\] \[code\]<Sql>CREATE FUNCTION func(a INT) RETURNS INT

\[/code\] \[code\]BEGIN

\[/code\]\[code\] return 1;

\[/code\] \[code\]END

</Sql>\[/code\]\[/quote\](I know this looks horrible, but there are NEWLINEs after \[code\]

\[/code\] and this editor did not make itt possible to show them as they are there that's why it seems there is an empty line between the lines.)and this is what I get after desrializing:\[code\]CREATE FUNCTION func(a INT) RETURNS INTBEGIN return 1;END\[/code\]so as you can see the newlines are doubled... any clue how to fix it?Thanks
 
Back
Top