Seite 1 von 1

QDomDocument: ">" wird zu ">"

Verfasst: 21. Oktober 2013 16:41
von Scary Hallo
Hallo

ich bearbeite ein XML-Dokument mit QDomDocument.
Danach wird aus der Zeile:

Code: Alles auswählen

<source><h3>WARNUNG!<br>Per...</h3> Durch .... <br> ....</source>
folgendes:

Code: Alles auswählen

<source><h3>WARNUNG!<br>Per...</h3> Durch .... <br> ....</source>
Kleines Beispiel:

Code: Alles auswählen

#include <QCoreApplication>

#include <QDomDocument>
#include <QFile>
#include <QTextStream>

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);

    QFile *file1 = new QFile("Before.ts");
    if(!file1->open(QIODevice::ReadOnly | QIODevice::Text))
        return -1;

    QDomDocument document;
    bool ok = document.setContent(file1);

    file1->close();

    QFile *file2 = new QFile("After.ts");
    if(!file2->open(QIODevice::WriteOnly | QIODevice::Text))
        return -2;

    QTextStream output(file2);
    document.save(output, QDomNode::EncodingFromDocument);

    file2->close();

    return 0;
}
Kann ich das abstellen?
:?: