Results 1 to 2 of 2

Thread: QDomDocument & XML

  1. #1

    Exclamation QDomDocument & XML

    I'm trying to use QDomDocument to parse xml file, but QDomDocument puts all the xml comments also in elements. Is there way to read the xml and ignore the comments? Nnow the whole idea about having comments is pretty much useless as they act as any other elements...

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: QDomDocument & XML

    I'm happy Qt does so, because if not you cannot modify your file without loosing the comments. And maybe you want modify them manually. But how you can remove the comments:
    1. Loop throught the nodes and delete all QDomNode::CommentNode nods
    2. Load your file and remove all comments with a reg exp before setting the file to your dom document

Similar Threads

  1. QDomDocument DTD location
    By Rayven in forum Qt Programming
    Replies: 6
    Last Post: 15th January 2011, 06:30
  2. Split QDomDocument to new QDomDocument
    By estanisgeyer in forum Qt Programming
    Replies: 4
    Last Post: 28th January 2009, 09:59
  3. QDomDocument inside other QDomDocument
    By estanisgeyer in forum Qt Programming
    Replies: 1
    Last Post: 13th November 2008, 15:27
  4. QDomDocument Speed by 24MB file
    By patrik08 in forum Qt Programming
    Replies: 3
    Last Post: 30th April 2007, 21:35
  5. Adding whitespace in QDomDocument
    By jakamph in forum Newbie
    Replies: 4
    Last Post: 6th February 2006, 22:06

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.