QXmlStreamWriter write QString as it is

  • Hi!

    I want to write a string after an element similar with the function "QXmlStreamWriter::writeCharacters":https://qt-project.org/doc/qt-4.8/qxmlstreamwriter.html#writeCharacters
    But I don't want that it will change my string and replace characters like _ " _ with ". Can anybody tell me, how? I tried some functions but without any result.

    I need to write this:
    @ <reference>GEOGCS["WGS 84",DATUM["World Geodetic System 1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.017453292519943,AUTHORITY["EPSG","9102"]],AUTHORITY["EPSG","4326"]]</reference>@

    Thank you in advance.

  • Moderators

    do you need the value string human readable in the XML file?
    If not an easy possibility would be to write the text base64 encoded:
    xmlStreamer.writeCharacters( QString("myText").toUtf8().toBase64() );
    Would that be enough for you?

  • I am copying a file format and they use it as I mentioned above, but it looks like, that it works also with the replacing characters.

    Thanks for the fast help!

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.