Results 1 to 5 of 5

Thread: Xml parsing

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Posts
    185
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Xml parsing

    Ok, QDomDocument is fine, the question is:

    How can I verift with the QDomDocument class that the XML is well formed ?

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

    Default Re: Xml parsing

    I think QDomDocument::setContent() will return false in such situation.

  3. #3
    Join Date
    Apr 2006
    Location
    Minsk, Belarus
    Posts
    33
    Thanks
    2
    Thanked 6 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Xml parsing

    Yes, and even more: it will return additional information in other parameters of this method (where it happened and why)

    Qt Code:
    1. QString errorStr;
    2. int errorLine;
    3. int errorColumn;
    4.  
    5. if (!doc.setContent(&file, true, &errorStr, &errorLine, &errorColumn))
    6. {
    7. //handling error here
    8. file.close();
    9. return false;
    10. }
    11.  
    12. file.close();
    To copy to clipboard, switch view to plain text mode 
    Last edited by wysota; 15th December 2006 at 11:49. Reason: missing [code] tags

Similar Threads

  1. parsing QtableWidget from a QStackedWidget
    By rosmarcha in forum Qt Programming
    Replies: 10
    Last Post: 13th October 2006, 14:36
  2. Config file parsing
    By Vash5556 in forum Qt Programming
    Replies: 2
    Last Post: 10th September 2006, 23:11
  3. Parsing of Text files in Qt
    By shailesh in forum Qt Programming
    Replies: 3
    Last Post: 21st April 2006, 15:35
  4. HTML Parsing
    By awalesminfo in forum Qt Programming
    Replies: 3
    Last Post: 19th March 2006, 11:31
  5. Trouble parsing using simple QRegExp
    By johnny_sparx in forum Qt Programming
    Replies: 4
    Last Post: 24th February 2006, 00:42

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.