ich bin neu in QT und habe QDomDocument eine XML-Datei geparst. Während des Parsens möchte ich den Wert eines Blatts ändern. Ich kann Attribute verändern und setzen ... aber wie ändere ich den Inhalt des Blatts?
Code: Alles auswählen
QDomElement root = domDoc.documentElement();
if( root.tagName() != "SectionCollection" )
cout << QString("WURZELFEHLER!");
QDomNode ebene1 = root.firstChild();
while (!ebene1.isNull()) {
QDomElement e = ebene1.toElement();
if( !e.isNull() && e.tagName() == "SectionCollectionItem" ) {
QDomNode ebene2 = ebene1.firstChild();
while (!ebene2.isNull()) {
QDomElement e2 = ebene2.toElement();
if( !e2.isNull()) {
if(e2.tagName() == "SectionData") {
QDomNode ebene3 = ebene2.firstChild();
while (!ebene3.isNull()) {
QDomElement e3 = ebene3.toElement();
if( !e3.isNull()) {
if(e3.tagName() == "DataCollectionItem") {
QDomNode ebene4 = ebene3.firstChild();
QString ident, value;
while (!ebene4.isNull()) {
QDomElement e4 = ebene4.toElement();
if( !e4.isNull()) {
if(e4.tagName() == "Ident") {
if (iniMap->contains(e4.text())) {
QDomElement temp = e4.nextSibling().toElement();
if (!temp.isNull() && temp.tagName() == "Value") {
[color=red]// HIER SETZEN DES NEUEN WERTS[/color]
}
}
}
}
cout << e4.tagName() +QString(":")+e4.text()+QString("\n");
ebene4 = ebene4.nextSibling();
}
}
}
ebene3 = ebene3.nextSibling();
}
} else if (e2.tagName() == "SectionName") {
}
}
ebene2 = ebene2.nextSibling();
}
}
ebene1 = ebene1.nextSibling();
}
QTextStream ts(&file);
ts << domDoc.toString();
file.close();