Quantcast
Channel: Jobs
Viewing all articles
Browse latest Browse all 18427

how to Append a Qxml file?? everytime the input data should be in the tag .

$
0
0
if i input data more than one there makes another <main>tag and data is stored in it, which is logically wrong i jux want tht everytime when i enter input the input data stored in the main <main> tag. that is logically true?? here is my code..  QDomDocument document;     QDomElement root =  document.createElement("main");// creating a main tag     document.appendChild(root);         QDomElement book = document.createElement("book");//secondry tag     book.setAttribute("Name ", ui->lineEdit->text());     book.setAttribute("ID ",ui->lineEdit1->text());     root.appendChild(book);//closing tag          QFile file("E:/z.xml");//the file where the input data is stored in xml     if(!file.open(QIODevice::Append | QIODevice::Text ))     {         qDebug() <<"Failed to open file  ";           }     else     {         QTextStream stream(&file);         stream << document.toString();         file.close();         qDebug() <<"finished";     }

Viewing all articles
Browse latest Browse all 18427

Trending Articles