How to Append a Qxml file?? everytime the input data should be in the <main> tag .

  • 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

    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&#40;"E:/z.xml"&#41;;//the file where the input data is stored in xml
    if(! | QIODevice::Text ))
        qDebug() <<"Failed to open file  ";
        QTextStream stream(&file);
        stream << document.toString();
        qDebug() <<"finished";


  • Lifetime Qt Champion

    Please, don't "duplicate": posts on the same subject

  • i just clarify my Question

  • Lifetime Qt Champion

    In that case, you can edit your original thread's title and content

Log in to reply