Показать сообщение отдельно
  #3  
Старый 14.01.2016, 03:47
Аватар для Alegun
Alegun Alegun вне форума
LMD-DML
 
Регистрация: 12.07.2009
Адрес: Богородское
Сообщения: 3,025
Версия Delphi: D7E
Репутация: 1834
По умолчанию

Не работает парсинг, поскольку результат:
Цитата:
0:
Не показывать: <div class='taigachat_messagetext ugc'>

Вывести результат: otpravka iz D7

Не показывать: <\/div>

1:
Не показывать: <div class='taigachat_messagetext ugc'>

Вывести результат: &gt;&gt; aHaJIuTuK: \u043a\u0442\u043e \u0442\u043e \u0432
\u0434\u0435\u043b\u0444\u0438 \u043f
\u0440\u0438\u043a\u0430\u043b\u044b
\u0432\u0430\u0435\u0442\u0441\u044f \u0445\u0414)

Не показывать: <\/div>

2:
Не показывать: <div class='taigachat_messagetext ugc'>

Вывести результат: <img src=\"http:\/\/s017.radikal.ru\/i437\/1601\/2a\/5230a91e4032.png\"
class=\"bbCodeImage LbImage\" alt=\"[&#x200B;IMG]\" data-
url=\"http:\/\/s017.radikal.ru\/i437\/1601\/2a
\/5230a91e4032.png\" \/>

Не показывать: <\/div>

3:
Не показывать: <div class='taigachat_messagetext ugc'>

Вывести результат: \u0443\u0440\u043e\u043a
\u0431\u0443\u0434\u0435\u0442 \u043f\u043e
\u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e <img
src=\"http:\/\/tophope.ru\/styles\/default\/xenforo\/smilies
\/smile.png\"
... здесь завис в сборке, нету закрывающего тега

З.Ы. Вот функция из drkb, с её помощью (почти) создан этот отчёт
Код:
Procedure IsolateText( Const S: String; Tag1, Tag2: String; list:TStrings );
Var
   pScan, pEnd, pTag1, pTag2: PChar;
   foundText: String;
   searchtext: String;
Begin
   { Set up pointers we need for the search. HTML is not case sensitive, so
     we need to perform the search on a uppercased copy of S.}
   searchtext := Uppercase(S);
   Tag1:= Uppercase( Tag1 );
   Tag2:= Uppercase( Tag2 );
   pTag1:= PChar(Tag1);
   pTag2:= PChar(Tag2);
   pScan:= PChar(searchtext);
   Repeat
     { Search for next occurence of Tag1. }
     pScan:= StrPos( pScan, pTag1 );
     If pScan <> Nil Then Begin
       { Found one, hop over it, then search from that position
         forward for the next occurence of Tag2. }
       Inc(pScan, Length( Tag1 ));
       pEnd := StrPos( pScan, pTag2 );
       If pEnd <> Nil Then Begin
         { Found start and end tag, isolate text between,
           add it to the list. We need to get the text from
           the original S, however, since we want the un-uppercased
           version! So we calculate the address pScan would hold if
           the search had been performed on S instead of searchtext. }
        SetString( foundText, 
                    Pchar(S) + (pScan- PChar(searchtext) ),
                    pEnd - pScan );
         list.Add( foundText );
         { Continue next search after the found end tag. }
         pScan := pEnd + Length(tag2);
       End { If }
       Else { Error, no end tag found for start tag, abort. }
         pScan := Nil;
     End; { If }
   Until pScan = Nil;
End;
Ответить с цитированием