I wand to remove all HTML tag to reformat document ...
Tidy can not make the job...

I test QString::remove & QRegExp line 10 and line 11 remove the close tag .. now i wand to remove the open tag i tested line 13 but .. remove all..
How can i make this?...


Qt Code:
  1. QString QLess::CleanTag( QString body )
  2. {
  3. qDebug() << "### start clean tag ";
  4. body.replace("<br>","##break##");
  5. body.replace("</br>","##break##");
  6. body.replace("</p>","##break##");
  7. body.replace("</td>","##break##");
  8. body.remove(QRegExp("<head>(.*)</head>"));
  9. body.remove(QRegExp("<form(.*)</form>"));
  10. body.remove(QRegExp("</(div|span|tr|td|br|body|html|tt|a|strong|p)>"));
  11. body.remove(QRegExp("</(DIV|SPAN|TR|TD|BR|BODY|HTML|TT|A|STRONG|P)>"));
  12. /*body.remove(QRegExp("<(div|span|tr|td|br|body|html|tt|a|strong|p)>"));*/
  13. /*body.remove(QRegExp("<(div|span|tr|td|br|body|html|tt|a|strong|p)( )(.*)(!>)>"));*/
  14. qDebug() << "### newbody " << body;
  15. return body;
  16. }
To copy to clipboard, switch view to plain text mode