Lazarus

Programming => Packages and Libraries => Topic started by: IndianaJones on July 19, 2011, 09:24:00 am

Title: [SOLVED]William Yang HTMLParser Compile Problem
Post by: IndianaJones on July 19, 2011, 09:24:00 am
Hi all,
Has anyone experiencing with the William Yang HTMLParser?
I tried to compile the library but it gives the following error.

/Users/lazarus-libs/HtmlParser/HTMLParser.pas(96,69) Error: range check error in set constructor or duplicate set element
The error line is as follows.
Const
   Breaks = [#0..' ', #$3A..#$40, '-', '~', '{', '"', '''', '\', '}', '<', '>', '='];                 

Any idea?
Title: Re: William Yang HTMLParser Compile Problem
Post by: Leledumbo on July 19, 2011, 04:22:10 pm
The last 3 characters:
Code: [Select]
'<', '>', '='is already covered by:
Code: [Select]
#$3A..#$40Just delete them.
Title: Re: William Yang HTMLParser Compile Problem
Post by: IndianaJones on July 19, 2011, 07:32:49 pm
Thanks Leledumbo
Title: Re: [SOLVED]William Yang HTMLParser Compile Problem
Post by: IndianaJones on July 20, 2011, 04:38:56 am

Hi again,
Has someone used this library before? Cos I cant figure out to get the text within the html tag like this.
In the following html text, I reached the href value, but not in the string.
<a href="/value/value">The text I want to get</a>

Any help would be appreciated. Thanks.
Title: Re: [SOLVED]William Yang HTMLParser Compile Problem
Post by: Sora-Kun on August 01, 2011, 01:57:40 pm
hi,
try write one on  your own if you don't find a solution.
It's not that difficult.

Cheers,, 
Title: Re: [SOLVED]William Yang HTMLParser Compile Problem
Post by: Leledumbo on August 02, 2011, 12:12:05 am
Code: [Select]
{$mode delphi}

uses
  Interfaces,
  HTMLParser,HTMLObjs;
const
  aHTML = '<a href="/value/value">The text I want to get</a>';
var
  aTag: TTagObject;
begin
  with THTMLParser.Create do
    try
      Text := aHTML;
      aTag := TagByName['a'];
      WriteLn(aTag.InnerText);
    finally
      Free;
    end;
end.
TinyPortal © 2005-2018