Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. [SOLVED] How I can get HTML from QDomElement object.

[SOLVED] How I can get HTML from QDomElement object.

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 1 Posters 948 Views
  • 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.
  • shavS Offline
    shavS Offline
    shav
    wrote on last edited by
    #1

    Hi everyone!

    In my application i need to use HTML parser which give me access to dom elements. In result I've receive the object of class QDomElement and I can get all information (tag name, attribute, content, etc). When I try to get content of element using 'text()' method I've received the plain text. How I can get content with HTML tags?

    To parse the HTML I use the QXmlInputSource and libxml2.

    Mac OS and iOS Developer

    1 Reply Last reply
    0
    • shavS Offline
      shavS Offline
      shav
      wrote on last edited by
      #2

      If you need to save HTML content of some HTML tag from QDomElement instance you can use code:
      @
      //....
      QDomElement itemTag = contentTags.at(k).toElement();
      //.....
      QString content;
      QTextStream ts(&content);
      itemTag.save(ts, itemTag.childNodes().count());
      qDebug()<<"content: "<<content; //<----Draw HTML code of itemTag
      @

      Mac OS and iOS Developer

      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