[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: Problem parsing data from KIO
From: Bosselut Cyril <bosselut () b1project ! com>
Date: 2003-07-23 13:19:31
[Download RAW message or body]
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
you can get all data in a temp QString and after split it with "\n" delimiter
and so get an array of QString.
My 2 cents.
Le Mercredi 23 Juillet 2003 15:10, Giuseppe Torelli a écrit :
> Hi,
>
> I have successfully used KIO::get to retrieve a web page.
> Now I have a problem in parsing data because the data come
> in a chunk of bytes. My problem is to have in a QString or qCString
> a line of HTML of which I want to strip the HTML tags off.
>
> This is a piece of code:
>
> void GetAddress::slotData (KIO::Job*, const QByteArray &data)
> {
> if (data.size() == 0) return;
> QCString HTML ( data, data.size()+1 );
> QRegExp rxlen( "(\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})");
> int pos = rxlen.search( HTML );
> if ( pos > -1 ) {
> QString value = rxlen.cap( 1 );
> printf ("%s\n",value.latin1() );
> }
> }
>
> The problem in this code is that in data I don't have a single line \n
> terminated but many characters. Obviously the QRegExp doesn't extract
> all the IP addresses contained in data but just some. How would you achieve
> to have in a QString a line of HTML ?
- --
L'honneur, c'est comme les allumettes:
ça ne sert qu'une fois. Marcel Pagnol.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)
iD8DBQE/Hotj9J4lbJfupC0RAigxAJ9AKnZX1ISbHrqx+Lq6CPebMtPjzwCgpEWG
mwUS1f++BMbJHLTxKMazjiw=
=Cgd4
-----END PGP SIGNATURE-----
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic