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. QDomNode and CDATA

QDomNode and CDATA

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 678 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.
  • I Offline
    I Offline
    IcodeO
    wrote on last edited by
    #1

    I'm using QDomDocument to retrieve items from an rss feed. Most rss feeds wrap the item descriptions (content:encoded or itunes:summary) with CDATA. Let's say that I'm using the code below to get the description.

    descriptionNode = QDomNode.namedItem("content:encoded");
    QString descriptionString = descriptionNode.toElement().text();
    

    Am I retrieving the CDATA as well as the text/html? How can I make sure that I'm only retrieving the text/html?

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

      Hi,

      Did you test that ?
      Do you have an XML example to check that ?

      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
      0
      • I Offline
        I Offline
        IcodeO
        wrote on last edited by
        #3

        I tested an rss feed by retrieving the content:encoded text and setting the html of a QTextBrowser. It correctly displayed a few links so I know the html is working but I don't know if the CDATA is still present. Does QTextBrowser ignore the CDATA wrapper in setHtml()? Either way, I still don't know if I'm grabbing the CDATA from the element text.

        QTextBrowser->setHtml(descriptionString);
        
        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          You can check the html by retrieving it again from QTextBrowser. If you want to see exactly what is happening with QTextBrowser, then the simplest is to check it source.

          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
          1

          • Login

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