Results 1 to 6 of 6

Thread: update the xml file from QT program

  1. #1
    Join Date
    Jan 2010
    Posts
    28
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default update the xml file from QT program

    hi , i am begginer in Qt . i unable to update and delete the data in an xmlfile using the Qt application. please can anybody tell me how to solve my problem. Attaching the xmledit file. please find the attachment.
    Attached Files Attached Files

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: update the xml file from QT program

    Well, working with QDomDocument is easier.
    QDomDocument::setContent and QDomDocument::toString might be what you need to read and write xml.

  3. #3
    Join Date
    Jan 2010
    Posts
    28
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: update the xml file from QT program

    sir,
    i have five .ui forms. Total .ui forms information should store in a single xml file. can we do this using QDomDocument?
    Last edited by rk0747; 28th January 2010 at 10:46. Reason: Clear explanation

  4. #4
    Join Date
    Jun 2009
    Location
    Noida
    Posts
    2
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: update the xml file from QT program

    Yes it is possible.
    First decide a XML format with initial data if necessary otherwise with blank data. Create in memory view of this XML and ensure all read write by ui forms are done in this XML(QDomDoc). At the time of applicatio exit save the content of this XML to file.

    QDomDocument doc("mydocument");
    QFile file("mydocument.xml");

    file.open(QIODevice::ReadOnly)


    doc.setContent(&file)
    file.close();

    //.........
    // Modify your XML here
    //.........


    QString savedXML=doc.toString();
    QTextStream tempTS(&savedXML);
    dom.save(tempTS,0);

  5. The following user says thank you to arvind_jki for this useful post:

    rk0747 (28th January 2010)

  6. #5
    Join Date
    Jan 2010
    Posts
    28
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: update the xml file from QT program

    ok, but i am very new to QdomDocument and i saw some examples i did n't understood due to more files and big code, please if u possible can u send me how to create and retrive the data from xml using QDomdocument or any sample code .
    i am struggling for this from 3 weeks .please help me.

    Thanks

  7. #6
    Join Date
    Jan 2009
    Location
    The Netherlands and Spain
    Posts
    150
    Thanks
    6
    Thanked 18 Times in 18 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: update the xml file from QT program

    Download this book:
    http://www.qtrac.eu/C++-GUI-Programm...t-4-1st-ed.zip
    and start reading from page 344.
    It won't get easier than this...

Similar Threads

  1. Replies: 5
    Last Post: 30th January 2010, 10:09
  2. Opening a program instead of a file
    By jaybstory in forum Newbie
    Replies: 4
    Last Post: 14th January 2010, 04:33
  3. Replies: 1
    Last Post: 11th November 2009, 17:28
  4. Open file without run again the program
    By avis_phoenix in forum Qt Programming
    Replies: 1
    Last Post: 7th August 2009, 23:01
  5. How to Update in .ini file?
    By phillip_Qt in forum Qt Programming
    Replies: 1
    Last Post: 15th April 2008, 13:40

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.