fast-html-parser icon indicating copy to clipboard operation
fast-html-parser copied to clipboard

GetElementById problem

Open hafedh-trimeche opened this issue 4 years ago • 0 comments

Hi,

This code returns and an empty HtmlTagEnd as output instead of an empty string and </div> for HtmlTagEnd.

procedure doHTML;
const
  RawHTML =
  '<!DOCTYPE html>' + #13#10 +
  '<html>' + #13#10 +
  '<head>' + #13#10 +
    '<meta http-equiv="content-type" content="text/html;' + #13#10 +
      'charset=windows-1252">' + #13#10 +
    '<title></title>' + #13#10 +
  '</head>' + #13#10 +
  '<body>' + #13#10 +
    '<div align="center"> <font color="#006600"><b>Strong Data Digital' + #13#10 +
          'Template</b></font> <br>' + #13#10 +
      '<font color="#000099">XML Base64 Encoded Document [xmlDoc]</font>' + #13#10 +
    '</div>' + #13#10 +
    '<div id="xmlDoc" style="display: none;">' + #13#10 +
    '</div>' + #13#10 +
  '</body>' + #13#10 +
  '</html>';
var
  Parser     : THTMLParser;
  HtmlTag    ,
  HtmlTagEnd : string;
begin
  Parser := THTMLParser.Create(RawHTML);
  Memo1.Lines.Text := Parser.GetElementById('xmlDoc',HtmlTag,HtmlTagEnd);
  FreeAndNil(Parser);
end;

Best regards.

hafedh-trimeche avatar May 24 '21 16:05 hafedh-trimeche