How to remove redundancy data read by QXmlQuery



  • @
    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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.