Results 1 to 2 of 2

Thread: Qt Xml QDomDocument Special character handling

  1. #1
    Join Date
    Apr 2013
    Posts
    3
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Qt Xml QDomDocument Special character handling

    Hi,

    I have QString which contains XML data that is obtained from a remote system.
    The problem with this data is that the special characters are not translated. for example & is not translated to &amp.
    When I try to parse this xml using QDomDocument's setContent method, I experience a failure.

    Does Qt Xml handling any how have the facility of escaping such characters or replacing them with the translated characters so that the Xml document becomes a valid document?

    Any help is greatly appreciated.
    Thanks

    Edit: Please note that I cannot change the data format that I am receiving as the remote system is not under my control, so CDATA option is not available.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Qt Xml QDomDocument Special character handling

    As a starting point:
    Qt4: http://doc.qt.digia.com/4.7/qt.html#escape
    Qt5: http://qt-project.org/doc/qt-5.0/qtc...#toHtmlEscaped

    But probably doing more than what you want

    Cheers,
    _

Similar Threads

  1. Some queries on the architecture of Qt character handling
    By balasaravanan in forum Qt for Embedded and Mobile
    Replies: 7
    Last Post: 11th November 2011, 10:29
  2. QString Special Character Problem
    By hakiim35 in forum Qt Programming
    Replies: 1
    Last Post: 3rd October 2011, 14:38
  3. Character by Character (Unicode?) File Reading
    By mclark in forum Qt Programming
    Replies: 4
    Last Post: 22nd April 2009, 15:28
  4. Special character's HTML entity to string
    By Hiba in forum Qt Programming
    Replies: 4
    Last Post: 3rd March 2009, 14:05
  5. Special Character Handling
    By Kubil in forum Qt Programming
    Replies: 1
    Last Post: 22nd June 2008, 22:58

Tags for this Thread

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.