[Qt-interest] Parsing a HTML document with non-supported html subsets

Constantin Makshin dinosaur-rus at users.sourceforge.net
Tue Jul 21 11:07:29 CEST 2009


This may not be the best solution, but I guess you could try to parse your  
HTML file manually as an XML document.

On Tue, 21 Jul 2009 11:54:55 +0400, Castagne Nicolas  
<nicolascastagne at yahoo.fr> wrote:
> Hi all and thanks Frank.
>
>> Do you mean ?
>> QString text=file->readAll();
>> Browser->setHtml(text)
>
> Indeed, no.
>
> My problem is that I have a html string containg a table with cells with  
> specific attributes, such as:
> ***********************
>   <tr height=13>
>    <td class=xl24 align=right width=75  
> x:num="1.23456789012346E28">1,23E+28</td>
>  </tr>
> ************************
>
> in which I need to retrieve the x:num attribute value in the <td> tag.
>
>
> Unfortunately, calls such as:
>     Browser->setHtml(text)
> removes some attributes that are present in text, ie:
>     Browser->toHtml()
> then returns a string without the x:num attribute.
>
> Hence : how should I parse my html string ?
> Is there a **hack** with QTextDocument that would allow me to ?
>
> Hope it is clearer.
> Best-
> Nicolas
>
>
> --- En date de : Lun 20.7.09, Frank Lutz <frank422542 at googlemail.com> a  
> écrit :
>
> De: Frank Lutz <frank422542 at googlemail.com>
> Objet: Re: [Qt-interest] Parsing a HTML document with non-supported html  
> subsets
> À: qt-interest at trolltech.com
> Date: Lundi 20 Juillet 2009, 16h53
>
> Do you mean ?
>
> ------
> QString text=file->readAll();
>        
> Browser->setHtml(text)
> --------
>
> greetings!
> _______________________________________________

-- 
Constantin "Dinosaur" Makshin



More information about the Qt-interest-old mailing list