I'm sorry. I will try to explain it better.
I want this:
1.- I parse a XML document. For example:
<?xml version="1.0" encoding="UTF-8"?>
<information>
<node1>data1<node1>
<node2>data2<node2>
</information>
<?xml version="1.0" encoding="UTF-8"?>
<information>
<node1>data1<node1>
<node2>data2<node2>
</information>
To copy to clipboard, switch view to plain text mode
The node1 and node2 values are put into QLineEdit's.
2.- I update the information from GUI. data1 --> "myValue1" and data2 --> "myValue2".
3.- I generate a XML with the new values. <-- How can I generate a new XML? I have a method with the XML hardcoded to generate the file. This is a problem if the XML changes or if the XML is very big.
<?xml version="1.0" encoding="UTF-8"?>
<information>
<node1>myValue1<node1>
<node2>myValue2<node2>
</information>
<?xml version="1.0" encoding="UTF-8"?>
<information>
<node1>myValue1<node1>
<node2>myValue2<node2>
</information>
To copy to clipboard, switch view to plain text mode
Now my code is like this:
"<?xml version="1.0" encoding="UTF-8"?>\n"\
"<information>\n"\
"\t\t<node1>%1<node1>\n"\
"\t\t<node2>%2<node2>\n"\
"</information>\n");
myXML = myXML.arg(data1).arg(data2); // data1 and data2 are QString with the information obtained from the GUI.
QString myXML = QString(
"<?xml version="1.0" encoding="UTF-8"?>\n"\
"<information>\n"\
"\t\t<node1>%1<node1>\n"\
"\t\t<node2>%2<node2>\n"\
"</information>\n");
myXML = myXML.arg(data1).arg(data2); // data1 and data2 are QString with the information obtained from the GUI.
To copy to clipboard, switch view to plain text mode
Bookmarks