Results 1 to 4 of 4

Thread: Best way to read xml

  1. #1
    Join Date
    May 2007
    Posts
    301
    Thanks
    46
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Best way to read xml

    Hi,

    I have the following XML :

    Qt Code:
    1. <WORKSPACE>
    2. <CANCHANNELS>
    3. <CAN id="1" baud="500" view="S">
    4. <FILTER type="PASS" ACCEPT="000" MASK="000" EXTENDED="0" FILTERONID="1">
    5. <CANFILTERS>
    6. <FILTERS ID="7e8" />
    7. <FILTERS ID="2e8" />
    8. <FILTERS ID="3e8" />
    9. </CANFILTERS>
    10. </FILTER>
    11. </CAN>
    12. <CAN id="2" baud="125" view="C">
    13. <FILTER type="PASS" ACCEPT="000" MASK="000" EXTENDED="0" FILTERONID="1">
    14. <CANFILTERS>
    15. <FILTERS ID="4e8" />
    16. <FILTERS ID="5e8" />
    17. </CANFILTERS>
    18. </FILTER>
    19. </CAN>
    20. </CANCHANNELS>
    21. </WORKSPACE>
    To copy to clipboard, switch view to plain text mode 

    Just wondering if QXmlStreamReader is the way to go to read it in?

    Thanks for any advice,
    Steve

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Best way to read xml

    I'd use the DOM approach (QDomDocument and friends) but it depends on what exactly you want to do with the data.

  3. #3
    Join Date
    May 2007
    Posts
    301
    Thanks
    46
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Best way to read xml

    Thanks,

    Just want to read the xml into some structures I will be creating.

    I have just used QXmlStreamReader object, seemed easy enough.

  4. #4
    Join Date
    Mar 2006
    Location
    Mountain View, California
    Posts
    489
    Thanks
    3
    Thanked 74 Times in 54 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Best way to read xml

    I haven't used the new stream reader, but if you're just reading into a structure, it sounds the way to go.

Similar Threads

  1. How to read Raw Information from CD in MAC?
    By vishal.chauhan in forum General Programming
    Replies: 0
    Last Post: 10th July 2007, 12:26
  2. How to read CD with read?
    By vishal.chauhan in forum Qt Programming
    Replies: 6
    Last Post: 29th June 2007, 08:20
  3. QIODevice read()
    By ShaChris23 in forum Newbie
    Replies: 1
    Last Post: 3rd May 2007, 00:29
  4. How to Read and display BMP image using QT
    By agsrinivasan in forum Qt Programming
    Replies: 3
    Last Post: 29th January 2007, 07:14
  5. Replies: 13
    Last Post: 1st June 2006, 14:01

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.