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. QtXml: How to read text of element from xml file.
Forum Updated to NodeBB v4.3 + New Features

QtXml: How to read text of element from xml file.

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 2 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
    ShrikantAmbade
    wrote on last edited by
    #1

    Hello everyone,

    I want to read text of element for example:

    <state-space> xyz </state-space>
    

    I want to read "xyz" from the above example. I already read element but dont know how to read text from element.

    Many Thanks,

    ? 1 Reply Last reply
    0
    • S ShrikantAmbade

      Hello everyone,

      I want to read text of element for example:

      <state-space> xyz </state-space>
      

      I want to read "xyz" from the above example. I already read element but dont know how to read text from element.

      Many Thanks,

      ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

      @ShrikantAmbade Hi! I guess you're using QXmlStreamReader. Is this correct?

      S 1 Reply Last reply
      0
      • ? A Former User

        @ShrikantAmbade Hi! I guess you're using QXmlStreamReader. Is this correct?

        S Offline
        S Offline
        ShrikantAmbade
        wrote on last edited by
        #3

        @Wieland No, I am using QDomDocument

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

          Ok. So you already got the QDomElement that contains "state-space". You can get the text of that element using QString QDomElement::text() const. See: http://doc.qt.io/qt-5/qdomelement.html#text

          S 1 Reply Last reply
          1
          • ? A Former User

            Ok. So you already got the QDomElement that contains "state-space". You can get the text of that element using QString QDomElement::text() const. See: http://doc.qt.io/qt-5/qdomelement.html#text

            S Offline
            S Offline
            ShrikantAmbade
            wrote on last edited by
            #5

            @Wieland Thank you so much :)

            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