[Interest] strange character '
' appended by QTextEdit
baneyue
baneyue at gmail.com
Fri Oct 18 11:37:39 CEST 2013
Hi guys:
I use a QTextEdit to edit the style string stored in a xml file like
this:
<styles>
<style id="style_1">
Road {
stroke: #c1c566;
stroke-width: 2;
...
}
</style>
<style id="style_2">
River {
stroke: #22aecc;
stroke-width: 3;
...
}
</style>
...
</styles>
I retrieved the style text with QDom and put it into a QTextEdit
using explicitly __QTextEdit.setPlainText()__. Then I change the
string in QTextEdit, and write back to the style file using the
string got by __QTextEdit.toPlainText()__.
But when i change the style string with `id="style_1"` and write
back to file, all the RESTS style nodes in the xml get one or more
`additional` characters at the end, which is the strange '
',
just like this:
<styles>
<style id="style_1">
Road {
stroke: #c1c566;
stroke-width: 2;
...
}
</style>
<style id="style_2">
River {
stroke: #22aecc;
stroke-width: 3;
...
}
</style>
...
</styles>
I've found some similiar situation on the stackoverflow[1], the
answer marked with `Correct` suggested that the xml node should keep
all characters in **one** line, but i really need to store it in a
__stuctured__ way **WITHOUT** the `
`.
So, what should I do to achieve this.
[1]:
stackoverflow.com/questions/848841/c-sharp-xslt-transform-adding-xa-and-xd-to-the-output/849617#849617
Regards,
baneyue
More information about the Interest
mailing list