Results 1 to 3 of 3

Thread: XML file writing

  1. #1
    Join Date
    Jan 2006
    Location
    Minnesota
    Posts
    14
    Qt products
    Qt4
    Platforms
    Windows

    Default XML file writing

    I am reading in an XML file using QDomElement and everything is working fine. My problem is when I write the xml out after changes, the attributes in my elements are not getting printed in the order that I want them.

    This is the order in which I have my file setup:

    <var name="width" value="3" units="m" />

    And this is the order in which the are written:

    <var units="m" value="3" name="width" />

    I was wondering if I can specifiy the order in which the attributes are written.

    Thanks.

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: XML file writing

    Just curious, why do you even care about the order?

    As far as I remember, QDomElement stores it's attributes in an unordered hash and it surely does not care about the order of the attributes. Since QDom* classes in general have no virtual methods, you might have to implement the recursive writing all by yourself.
    J-P Nurmi

  3. #3
    Join Date
    Jan 2006
    Location
    Minnesota
    Posts
    14
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: XML file writing

    The reason I care about the order is my program is going to be used by other people who want to quickly look at the data file (XML file) without loading the program and figure out which values were changed. And one of the nice things would be to see the name of the value first, then the value and then the units.

Similar Threads

  1. Draging a non-existing file to the Windows Desktop
    By klaus1111 in forum Qt Programming
    Replies: 13
    Last Post: 20th September 2007, 11:47
  2. Accessing DTD in an XML file via QtXml module?
    By jorma in forum Qt Programming
    Replies: 1
    Last Post: 6th May 2006, 18:09
  3. Replies: 6
    Last Post: 27th February 2006, 12:47
  4. create file in another directory
    By raphaelf in forum Qt Programming
    Replies: 3
    Last Post: 16th February 2006, 10:04
  5. dialog box
    By Bahar in forum Qt Programming
    Replies: 3
    Last Post: 31st January 2006, 14:52

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.