Giter Site home page Giter Site logo

fast-html-parser's People

Contributors

z505 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fast-html-parser's Issues

GetElementById problem

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.

'const' string params

add 'const' for str params in all funcs where S is not changed.


function IsTag(TagType: string; Tag: string): boolean;
function IsCloseTag(TagType: string; Tag: string): boolean;
function Substr(sub, s: string): boolean;
function StripTabs(s: string): string;
function ReturnsToSpaces(s: string): string;
function LessenSpaces(s: string): string;
function CleanHtm1(s: string): string;

rename event types to make common prefix

  TOnFoundTag = procedure(NoCaseTag, ActualTag: string) of object;
  // procedural:
  TOnFoundTagP = procedure(NoCaseTag, ActualTag: string);

  // when text  found in the HTML
  TOnFoundText = procedure(Text: string) of object;
  // procedural:
  TOnFoundTextP = procedure(Text: string);

->

THtmlParserOnFoundTag
THtmlParserOnFoundText
etc

prefix helper funcs with some str

E.g. "html_" prefix

function IsTag(TagType: string; Tag: string): boolean;
function IsCloseTag(TagType: string; Tag: string): boolean;

->

function html_IsTag(TagType: string; Tag: string): boolean;
function html_IsCloseTag(TagType: string; Tag: string): boolean;

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.