Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QXmlStreamWriter write QString as it is
Qt 6.11 is out! See what's new in the release blog

QXmlStreamWriter write QString as it is

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.8k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    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.
    Greetings

    1 Reply Last reply
    0
    • raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      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?

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      0
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #3

        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!

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved