Hi guys,
lḿ writing few rows of code to edit XML like this:
<?xml version="1.0" encoding="UTF-8"?>
<data>
<fam_number>123</fam_number>
</data>
<?xml version="1.0" encoding="UTF-8"?>
<data>
<fam_number>123</fam_number>
</data>
To copy to clipboard, switch view to plain text mode
So i google it, then l tought that, this should write xml (loaded by qresource):
doc.appendChild (xmlroot);
QStandardItem *fam
= root
->child
(0,
0);
// Here Segmantation FAULT fam->setText (family_number);
QFile file(":/data.xml");
qDebug () << "Fail";
stream << doc.toString ();
file.close ();
QDomDocument doc;
QDomElement xmlroot= doc.createElement ("data");
doc.appendChild (xmlroot);
QStandardItemModel *model = new QStandardItemModel(0,0);
QStandardItem *root = model->item (0,0);
QStandardItem *fam = root->child (0,0); // Here Segmantation FAULT
fam->setText (family_number);
QFile file(":/data.xml");
if(!file.open (QIODevice::WriteOnly | QIODevice::Text)) // Here FAILED to open
qDebug () << "Fail";
QTextStream stream(&file);
stream << doc.toString ();
file.close ();
To copy to clipboard, switch view to plain text mode
But l get SEG FAILED and FAILED to open.
Can you please help me ? Thanks
Bookmarks