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. How to remove redundancy data read by QXmlQuery
Qt 6.11 is out! See what's new in the release blog

How to remove redundancy data read by QXmlQuery

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 934 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
    stereomatching
    wrote on last edited by
    #1

    @
    QFile file("sample.html");

        fileIsValid(file);
    
        QXmlQuery xmlQuery_;
        xmlQuery_.setFocus(&file);       
        xmlQuery_.setQuery("//*");
    
        if(!xmlQuery_.isValid())
        {
            qDebug() << "query error";
            return 0;
        }
    
        QString result;
        xmlQuery_.evaluateTo(&result);
    
        qDebug() << result;
    

    @

    the xml
    @
    <html>
    <blockquote>aaa</blockquote>
    <blockquote>bbb</blockquote>
    <blockquote>ccc</blockquote>
    <blockquote>ddd</blockquote>
    <blockquote>eee</blockquote>
    </html>
    @
    the output
    @
    "<html>
    <blockquote>aaa</blockquote>
    <blockquote>bbb</blockquote>
    <blockquote>ccc</blockquote>
    <blockquote>ddd</blockquote>
    <blockquote>eee</blockquote>
    </html>
    <blockquote>aaa</blockquote>
    <blockquote>bbb</blockquote>
    <blockquote>ccc</blockquote>
    <blockquote>ddd</blockquote>
    <blockquote>eee</blockquote>
    "
    @
    Don't know why the result of blockquote would repeat again

    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