Results 1 to 8 of 8

Thread: Parsing XML file

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Posts
    128
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanked 28 Times in 27 Posts

    Default Re: Parsing XML file

    The docs are your friend ;-)


    Try attributeNode

    i.e.
    Qt Code:
    1. QDomAttr attr = element.attributeNode(QLatin1String("type"));
    To copy to clipboard, switch view to plain text mode 

  2. The following user says thank you to camel for this useful post:

    Djony (8th January 2007)

  3. #2
    Join Date
    Nov 2006
    Posts
    72
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    8
    Thanked 1 Time in 1 Post

    Default Re: Parsing XML file

    Thanks for your replies. That did it. I have another problem. When I am browsing through my tags (id,owner,requirement,module,... look at the structure of xml file in above post) I use this line
    Qt Code:
    1. platformDetail=platformDetail.nextSiblingElement(platformDetail.tagName());
    2. //platformDetail is QDomElement class
    To copy to clipboard, switch view to plain text mode 
    And I can't get any tags. Do you have any idea what could be problem? Similar line worked fine for platform tags...

  4. #3
    Join Date
    Jan 2006
    Posts
    128
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanked 28 Times in 27 Posts

    Default Re: Parsing XML file

    Quote Originally Posted by Djony View Post
    Do you have any idea what could be problem?
    Once again. Check the docs:
    Returns the next sibilng element with tag name tagName if tagName is non-empty; otherwise returns any next sibling element.
    What does that tell you? You try to get the next sibling element with the same name as the current element. Is that what you want?

    Please take the time to read through the documentation, perhaps starting from here, as the qdomdocument page is a good entry point.

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. How To Extract A File
    By deekayt in forum General Programming
    Replies: 7
    Last Post: 5th December 2006, 18:27
  3. Config file parsing
    By Vash5556 in forum Qt Programming
    Replies: 2
    Last Post: 10th September 2006, 23:11
  4. SQLite-DB in a qrc file
    By Lykurg in forum Qt Programming
    Replies: 5
    Last Post: 31st July 2006, 19:24
  5. Accessing DTD in an XML file via QtXml module?
    By jorma in forum Qt Programming
    Replies: 1
    Last Post: 6th May 2006, 18:09

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
  •  
Qt is a trademark of The Qt Company.