Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. XMLStreamWriter is writing the xml version and encoding type
Forum Updated to NodeBB v4.3 + New Features

XMLStreamWriter is writing the xml version and encoding type

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
8 Posts 4 Posters 1.7k 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.
  • S Offline
    S Offline
    Sriu1
    wrote on last edited by
    #1

    Im writing an XML using streamwriter by default the below line is getting added at the begining How to remove this?
    <?xml version="1.0" encoding="UTF-8"?>

    1 Reply Last reply
    0
    • Pablo J. RoginaP Offline
      Pablo J. RoginaP Offline
      Pablo J. Rogina
      wrote on last edited by
      #2

      @Sriu1 are you sure you don't want such first line? Per XML specification is called document type declaration and "must appear before the first element in the document"

      Upvote the answer(s) that helped you solve the issue
      Use "Topic Tools" button to mark your post as Solved
      Add screenshots via postimage.org
      Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      2
      • S Offline
        S Offline
        Sriu1
        wrote on last edited by
        #3

        Hi,
        @Pablo-J-Rogina Yes I want to get rid of them.Its getting written everytime I write new XML.And this version line is not being parsed.So I want to get rid of this line

        jsulmJ 1 Reply Last reply
        0
        • S Sriu1

          Hi,
          @Pablo-J-Rogina Yes I want to get rid of them.Its getting written everytime I write new XML.And this version line is not being parsed.So I want to get rid of this line

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Sriu1 Does this line cause any problems? If not why bother?

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          2
          • S Offline
            S Offline
            Sriu1
            wrote on last edited by
            #5

            @jsulm Yes it is causing problems.Please suggest how to remove it.

            jsulmJ 1 Reply Last reply
            0
            • S Sriu1

              @jsulm Yes it is causing problems.Please suggest how to remove it.

              jsulmJ Offline
              jsulmJ Offline
              jsulm
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @Sriu1 May I ask what problem it causes? As mentioned by @Pablo-J-Rogina this line is part of XML standard.
              If you still want to remove it then you can do it manually: first write the file then read it and write manually skipping the first line.

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              1
              • S Offline
                S Offline
                Sriu1
                wrote on last edited by
                #7

                Im trying to run an old application using my XML.The application is working only if I remove XML declaration.So I want to get rid of it every time I write XML

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  I haven't tested it but wouldn't just not calling writeStartDocument achieve what you want ?

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  2

                  • Login

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