View Full Version : Qt Xml QDomDocument Special character handling

6th November 2013, 15:06

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.

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.

6th November 2013, 16:47
As a starting point:
Qt4: http://doc.qt.digia.com/4.7/qt.html#escape
Qt5: http://qt-project.org/doc/qt-5.0/qtcore/qstring.html#toHtmlEscaped

But probably doing more than what you want