jakamph
6th February 2006, 16:54
I'm using QT 3.3.1 on Sun/Windows XP and creating an output file in XML using QDomDocument. I'm beginning the file using a couple of comments and then appending the comment to the document.
QDomDocument myDoc = QDomDocument( );
QDomElement myElement;
QDomComment myComment = myDoc.createComment( "This is the first comment." );
myDoc.appendChild( myComment );
myComment = myDoc.createComment( "This is the second comment." );
myDoc.appendChild( myComment );
while (anotherElementToAdd)
{
/* I add a bunch of elements to the document */
}
I then use toString( 4 ) to output the file as a string and then send it to an ofstream file to save it to a file. However, the output of the file has the two comments along with the first element all on the same line. Is there a way to force a carriage return using QDomDocument?
Thanks for your help.
QDomDocument myDoc = QDomDocument( );
QDomElement myElement;
QDomComment myComment = myDoc.createComment( "This is the first comment." );
myDoc.appendChild( myComment );
myComment = myDoc.createComment( "This is the second comment." );
myDoc.appendChild( myComment );
while (anotherElementToAdd)
{
/* I add a bunch of elements to the document */
}
I then use toString( 4 ) to output the file as a string and then send it to an ofstream file to save it to a file. However, the output of the file has the two comments along with the first element all on the same line. Is there a way to force a carriage return using QDomDocument?
Thanks for your help.