-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathHTMLp.HTMLReader.pas
766 lines (658 loc) · 18 KB
/
HTMLp.HTMLReader.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
unit HTMLp.HTMLReader;
interface
uses
Classes,
HTMLp.DomCore;
type
TDelimiters = set of Byte;
TReaderState = (rsInitial, rsBeforeAttr, rsBeforeValue, rsInValue, rsInQuotedValue);
THTMLReader = class
private
FHTMLStr: string;
FPosition: Integer;
FNodeType: Integer;
FPrefix: string;
FLocalName: string;
FNodeValue: string;
FPublicID: string;
FSystemID: string;
FIsEmptyElement: Boolean;
FState: TReaderState;
FQuotation: Word;
FOnAttributeEnd: TNotifyEvent;
FOnAttributeStart: TNotifyEvent;
FOnCDataSection: TNotifyEvent;
FOnComment: TNotifyEvent;
FOnDocType: TNotifyEvent;
FOnElementEnd: TNotifyEvent;
FOnElementStart: TNotifyEvent;
FOnEndElement: TNotifyEvent;
FOnEntityReference: TNotifyEvent;
FOnNotation: TNotifyEvent;
FOnProcessingInstruction: TNotifyEvent;
FOnScript: TNotifyEvent;
FOnTextNode: TNotifyEvent;
function GetNodeName: string;
function GetToken(Delimiters: TDelimiters): string;
function IsAttrTextChar: Boolean;
function IsDigit(HexBase: Boolean): Boolean;
function IsEndEntityChar: Boolean;
function IsEntityChar: Boolean;
function IsEqualChar: Boolean;
function IsHexEntityChar: Boolean;
function IsNumericEntity: Boolean;
function IsQuotation: Boolean;
function IsSlashChar: Boolean;
function IsSpecialTagChar: Boolean;
function IsStartCharacterData: Boolean;
function IsStartComment: Boolean;
function IsStartDocumentType: Boolean;
function IsStartEntityChar: Boolean;
function IsStartMarkupChar: Boolean;
function IsStartScript: Boolean;
function IsStartTagChar: Boolean;
function Match(const Signature: string; IgnoreCase: Boolean): Boolean;
function ReadAttrNode: Boolean;
function ReadAttrTextNode: Boolean;
function ReadCharacterData: Boolean;
function ReadComment: Boolean;
function ReadDocumentType: Boolean;
function ReadElementNode: Boolean;
function ReadEndElementNode: Boolean;
function ReadEntityNode: Boolean;
function ReadNamedEntityNode: Boolean;
function ReadNumericEntityNode: Boolean;
function ReadQuotedValue(var Value: string): Boolean;
function ReadScript: Boolean;
function ReadSpecialNode: Boolean;
function ReadTagNode: Boolean;
function ReadValueNode: Boolean;
function SkipTo(const Signature: string): Boolean;
procedure FireEvent(Event: TNotifyEvent);
procedure ReadElementTail;
procedure ReadTextNode;
procedure SetHTMLStr(const Value: string);
procedure SetNodeName(Value: string);
procedure SkipWhiteSpaces;
public
constructor Create;
function Read: Boolean;
property HTMLStr: string read FHTMLStr write SetHTMLStr;
property isEmptyElement: Boolean read FIsEmptyElement;
property LocalName: string read FLocalName;
property Name: string read GetNodeName;
property NodeType: Integer read FNodeType;
property Position: Integer read FPosition;
property Prefix: string read FPrefix;
property PublicID: string read FPublicID;
property State: TReaderState read FState;
property SystemID: string read FSystemID;
property NodeValue: string read FNodeValue;
property OnAttributeEnd: TNotifyEvent read FOnAttributeEnd write FOnAttributeEnd;
property OnAttributeStart: TNotifyEvent read FOnAttributeStart write FOnAttributeStart;
property OnCDataSection: TNotifyEvent read FOnCDataSection write FOnCDataSection;
property OnComment: TNotifyEvent read FOnComment write FOnComment;
property OnDocType: TNotifyEvent read FOnDocType write FOnDocType;
property OnElementEnd: TNotifyEvent read FOnElementEnd write FOnElementEnd;
property OnElementStart: TNotifyEvent read FOnElementStart write FOnElementStart;
property OnEndElement: TNotifyEvent read FOnEndElement write FOnEndElement;
property OnEntityReference: TNotifyEvent read FOnEntityReference write FOnEntityReference;
property OnNotation: TNotifyEvent read FOnNotation write FOnNotation;
property OnProcessingInstruction: TNotifyEvent read FOnProcessingInstruction write FOnProcessingInstruction;
property OnScript: TNotifyEvent read FOnScript write FOnScript;
property OnTextNode: TNotifyEvent read FOnTextNode write FOnTextNode;
end;
implementation
uses
SysUtils;
const
startTagChar = Ord('<');
endTagChar = Ord('>');
specialTagChar = Ord('!');
slashChar = Ord('/');
equalChar = Ord('=');
quotation = [Ord(''''), Ord('"')];
tagDelimiter = [slashChar, endTagChar];
tagNameDelimiter = whiteSpace + tagDelimiter;
attrNameDelimiter = tagNameDelimiter + [equalChar];
startEntity = Ord('&');
startMarkup = [startTagChar, startEntity];
endEntity = Ord(';');
notEntity = [endEntity] + startMarkup + whiteSpace;
notAttrText = whiteSpace + quotation + tagDelimiter;
numericEntity = Ord('#');
hexEntity = [Ord('x'), Ord('X')];
decDigit = [Ord('0')..Ord('9')];
hexDigit = [Ord('a')..Ord('f'), Ord('A')..Ord('F')];
DocTypeStartStr = 'DOCTYPE';
DocTypeEndStr = '>';
CDataStartStr = '[CDATA[';
CDataEndStr = ']]>';
CommentStartStr = '--';
CommentEndStr = '-->';
ScriptStartStr = 'script';
ScriptEndStr = '</script>';
function DecValue(const Digit: WideChar): Word;
begin
Result := Ord(Digit) - Ord('0')
end;
function HexValue(const HexChar: WideChar): Word;
var
C: Char;
begin
if Ord(HexChar) in decDigit then Result := Ord(HexChar) - Ord('0')
else
begin
C := UpCase(Chr(Ord(HexChar)));
Result := Ord(C) - Ord('A');
end
end;
constructor THTMLReader.Create;
begin
inherited Create;
FHTMLStr := HTMLStr;
FPosition := 1
end;
function THTMLReader.GetNodeName: string;
begin
if FPrefix <> '' then Result := FPrefix + ':' + FLocalName
else Result := FLocalName;
end;
function THTMLReader.GetToken(Delimiters: TDelimiters): string;
var
Start: Integer;
begin
Start := FPosition;
while (FPosition <= Length(FHTMLStr)) and not (Ord(FHTMLStr[FPosition]) in Delimiters) do Inc(FPosition);
Result := Copy(FHTMLStr, Start, FPosition - Start);
end;
function THTMLReader.IsAttrTextChar: Boolean;
var
WC: WideChar;
begin
WC := FHTMLStr[FPosition];
if FState = rsInQuotedValue then Result := (Ord(WC) <> FQuotation) and (Ord(WC) <> startEntity)
else Result := not (Ord(WC) in notAttrText);
end;
function THTMLReader.IsDigit(HexBase: Boolean): Boolean;
var
WC: WideChar;
begin
WC := FHTMLStr[FPosition];
Result := Ord(WC) in decDigit;
if not Result and HexBase then Result := (Ord(WC) in hexDigit);
end;
function THTMLReader.IsEndEntityChar: Boolean;
var
WC: WideChar;
begin
WC := FHTMLStr[FPosition];
Result := (Ord(WC) = endEntity);
end;
function THTMLReader.IsEntityChar: Boolean;
var
WC: WideChar;
begin
WC := FHTMLStr[FPosition];
Result := not (Ord(WC) in notEntity);
end;
function THTMLReader.IsEqualChar: Boolean;
var
WC: WideChar;
begin
WC := FHTMLStr[FPosition];
Result := (Ord(WC) = equalChar);
end;
function THTMLReader.IsHexEntityChar: Boolean;
var
WC: WideChar;
begin
WC := FHTMLStr[FPosition];
Result := (Ord(WC) in hexEntity);
end;
function THTMLReader.IsNumericEntity: Boolean;
var
WC: WideChar;
begin
WC := FHTMLStr[FPosition];
Result := (Ord(WC) = numericEntity);
end;
function THTMLReader.IsQuotation: Boolean;
var
WC: WideChar;
begin
WC := FHTMLStr[FPosition];
if FQuotation = 0 then Result := (Ord(WC) in quotation)
else Result := (Ord(WC) = FQuotation);
end;
function THTMLReader.IsSlashChar: Boolean;
var
WC: WideChar;
begin
WC := FHTMLStr[FPosition];
Result := (Ord(WC) = slashChar);
end;
function THTMLReader.IsSpecialTagChar: Boolean;
var
WC: WideChar;
begin
WC := FHTMLStr[FPosition];
Result := (Ord(WC) = specialTagChar);
end;
function THTMLReader.IsStartCharacterData: Boolean;
begin
Result := Match(CDataStartStr, False);
end;
function THTMLReader.IsStartComment: Boolean;
begin
Result := Match(CommentStartStr, False);
end;
function THTMLReader.IsStartDocumentType: Boolean;
begin
Result := Match(DocTypeStartStr, True);
end;
function THTMLReader.IsStartEntityChar: Boolean;
var
WC: WideChar;
begin
WC := FHTMLStr[FPosition];
Result := (Ord(WC) = startEntity);
end;
function THTMLReader.IsStartMarkupChar: Boolean;
var
WC: WideChar;
begin
WC := FHTMLStr[FPosition];
Result := (Ord(WC) in startMarkup);
end;
function THTMLReader.IsStartScript: Boolean;
begin
Result := Match(ScriptStartStr, true);
end;
function THTMLReader.IsStartTagChar: Boolean;
var
WC: WideChar;
begin
WC := FHTMLStr[FPosition];
Result := (Ord(WC) = startTagChar);
end;
function THTMLReader.Match(const Signature: string; IgnoreCase: Boolean): Boolean;
var
I, J: Integer;
W1, W2: WideChar;
begin
Result := False;
for I := 1 to Length(Signature) do
begin
J := FPosition + I - 1;
if (J < 1) or (J > Length(FHTMLStr)) then Exit;
W1 := Signature[I];
W2 := FHTMLStr[J];
if (W1 <> W2)
and (not IgnoreCase or (UpperCase(W1) <> UpperCase(W2))) then Exit;
end;
Result := True;
end;
function THTMLReader.ReadAttrNode: Boolean;
var
AttrName: string;
begin
Result := False;
SkipWhiteSpaces;
AttrName := LowerCase(GetToken(attrNameDelimiter));
if AttrName = '' then Exit;
SetNodeName(AttrName);
FireEvent(FOnAttributeStart);
FState := rsBeforeValue;
FQuotation := 0;
Result := True;
end;
function THTMLReader.ReadAttrTextNode: Boolean;
var
Start: Integer;
begin
Result := False;
Start := FPosition;
while (FPosition <= Length(FHTMLStr)) and (IsAttrTextChar) do Inc(FPosition);
if FPosition = Start then Exit;
FNodeType := TEXT_NODE;
FNodeValue:= Copy(FHTMLStr, Start, FPosition - Start);
FireEvent(FOnTextNode);
Result := True;
end;
function THTMLReader.ReadCharacterData: Boolean;
var
StartPos: Integer;
begin
Inc(FPosition, Length(CDataStartStr));
StartPos := FPosition;
Result := SkipTo(CDataEndStr);
if Result then
begin
FNodeType := CDATA_SECTION_NODE;
FNodeValue := Copy(FHTMLStr, StartPos, FPosition - StartPos - Length(CDataEndStr));
FireEvent(FOnCDataSection)
end
end;
function THTMLReader.ReadComment: Boolean;
var
StartPos: Integer;
begin
Inc(FPosition, Length(CommentStartStr));
StartPos := FPosition;
Result := SkipTo(CommentEndStr);
if Result then
begin
FNodeType := COMMENT_NODE;
FNodeValue := Copy(FHTMLStr, StartPos, FPosition - StartPos - Length(CommentEndStr));
FireEvent(FOnComment);
end;
end;
function THTMLReader.ReadDocumentType: Boolean;
var
Name: string;
begin
Result := False;
Inc(FPosition, Length(DocTypeStartStr));
SkipWhiteSpaces;
Name := GetToken(tagNameDelimiter);
if Name = '' then Exit;
SetNodeName(Name);
SkipWhiteSpaces;
GetToken(tagNameDelimiter);
SkipWhiteSpaces;
if ((FHTMLStr[FPosition] = '"') or (FHTMLStr[FPosition] = '''')) and not (ReadQuotedValue(FPublicID)) then Exit;
SkipWhiteSpaces;
if FHTMLStr[FPosition] = '"' then
begin
if not ReadQuotedValue(FSystemID) then Exit
end;
Result := SkipTo(DocTypeEndStr);
end;
function THTMLReader.ReadElementNode: Boolean;
var
TagName: string;
begin
Result := False;
if FPosition < Length(FHTMLStr) then
begin
TagName := LowerCase(GetToken(tagNameDelimiter));
if TagName = '' then Exit;
FNodeType := ELEMENT_NODE;
SetNodeName(TagName);
FState := rsBeforeAttr;
FireEvent(FOnElementStart);
Result := True;
end;
end;
function THTMLReader.ReadEndElementNode: Boolean;
var
TagName: string;
begin
Result := False;
Inc(FPosition);
if FPosition > Length(FHTMLStr) then Exit;
TagName := LowerCase(GetToken(tagNameDelimiter));
if TagName = '' then Exit;
Result := SkipTo(WideChar(endTagChar));
if Result then
begin
FNodeType := END_ELEMENT_NODE;
SetNodeName(TagName);
FireEvent(FOnEndElement);
Result := True;
end;
end;
function THTMLReader.ReadEntityNode: Boolean;
var
CurrPos: Integer;
begin
Result := False;
CurrPos := FPosition;
Inc(FPosition);
if FPosition > Length(FHTMLStr) then Exit;
if IsNumericEntity then
begin
Inc(FPosition);
Result := ReadNumericEntityNode;
end
else Result := ReadNamedEntityNode;
if Result then
begin
FNodeType := ENTITY_REFERENCE_NODE;
// FireEvent(FOnEntityReference); VVV - remove, entity node is added in ReadXXXEntityNode
end
else FPosition := CurrPos;
end;
function THTMLReader.ReadNamedEntityNode: Boolean;
var
Start: Integer;
begin
Result := False;
if FPosition > Length(FHTMLStr) then Exit;
Start := FPosition;
while (FPosition <= Length(FHTMLStr)) and IsEntityChar do Inc(FPosition);
if (FPosition > Length(FHTMLStr)) or not IsEndEntityChar then Exit;
FNodeType := ENTITY_REFERENCE_NODE;
SetNodeName(Copy(FHTMLStr, Start, FPosition - Start));
Inc(FPosition);
FireEvent(FOnEntityReference);
Result := True;
end;
function THTMLReader.ReadNumericEntityNode: Boolean;
var
Value: Word;
HexBase: Boolean;
begin
Result := False;
if FPosition > Length(FHTMLStr) then Exit;
HexBase := IsHexEntityChar;
if HexBase then Inc(FPosition);
Value := 0;
while (FPosition <= Length(FHTMLStr)) and IsDigit(HexBase) do
begin
try
if HexBase then Value := Value * 16 + HexValue(FHTMLStr[FPosition])
else Value := Value * 10 + DecValue(FHTMLStr[FPosition])
except
Exit
end;
Inc(FPosition);
end;
if (FPosition > Length(FHTMLStr)) or not IsEndEntityChar then Exit;
Inc(FPosition);
FNodeType := TEXT_NODE;
FNodeValue := WideChar(Value);
FireEvent(FOnTextNode);
Result := True;
end;
function THTMLReader.ReadQuotedValue(var Value: string): Boolean;
var
QuotedChar: WideChar;
Start: Integer;
begin
QuotedChar := FHTMLStr[FPosition];
Inc(FPosition);
Start := FPosition;
Result := SkipTo(QuotedChar);
if Result then Value := Copy(FHTMLStr, Start, FPosition - Start);
end;
function THTMLReader.ReadScript: Boolean;
var
StartPos: Integer;
begin
Inc(FPosition, Length(ScriptStartStr));
StartPos := FPosition;
Result := SkipTo(ScriptEndStr);
if Result then
begin
FNodeType := SCRIPT_NODE;
FNodeValue := Copy(FHtmlStr, StartPos, FPosition - StartPos - Length(ScriptEndStr));
FireEvent(FOnScript)
end
end;
function THTMLReader.ReadSpecialNode: Boolean;
begin
Result := False;
Inc(FPosition);
if FPosition > Length(FHTMLStr) then Exit;
if IsStartDocumentType then Result := ReadDocumentType
else if IsStartCharacterData then Result := ReadCharacterData
else if IsStartComment then Result := ReadComment;
end;
function THTMLReader.ReadTagNode: Boolean;
var
CurrPos: Integer;
begin
Result := False;
CurrPos := FPosition;
Inc(FPosition);
if FPosition > Length(FHTMLStr) then Exit;
if IsSlashChar then Result := ReadEndElementNode
else if IsSpecialTagChar then Result := ReadSpecialNode
else if IsStartScript then Result := ReadScript
else Result := ReadElementNode;
if not Result then FPosition := CurrPos;
end;
function THTMLReader.SkipTo(const Signature: string): Boolean;
begin
while FPosition <= Length(FHTMLStr) do
begin
if Match(Signature, False) then
begin
Inc(FPosition, Length(Signature));
Exit(True);
end;
Inc(FPosition);
end;
Result := False;
end;
procedure THTMLReader.FireEvent(Event: TNotifyEvent);
begin
if Assigned(Event) then Event(Self);
end;
function THTMLReader.Read: Boolean;
begin
FNodeType := NONE;
FPrefix := '';
FLocalName := '';
FNodeValue := '';
FPublicID := '';
FSystemID := '';
FIsEmptyElement := False;
Result := False;
if FPosition > Length(FHTMLStr) then Exit;
Result := True;
if FState in [rsBeforeValue, rsInValue, rsInQuotedValue] then
begin
if ReadValueNode then Exit;
if FState = rsInQuotedValue then Inc(FPosition);
FNodeType := ATTRIBUTE_NODE;
FireEvent(FOnAttributeEnd);
FState := rsBeforeAttr;
end
else if FState = rsBeforeAttr then
begin
if ReadAttrNode then Exit;
ReadElementTail;
FState := rsInitial;
end
else if IsStartTagChar then
begin
if ReadTagNode then Exit;
Inc(FPosition);
FNodeType := ENTITY_REFERENCE_NODE;
SetNodeName('lt');
FireEvent(FOnEntityReference);
end
else if IsStartEntityChar then
begin
if ReadEntityNode then Exit;
Inc(FPosition);
FNodeType := ENTITY_REFERENCE_NODE;
SetNodeName('amp');
FireEvent(FOnEntityReference);
end
else ReadTextNode;
end;
procedure THTMLReader.ReadTextNode;
var
Start: Integer;
begin
Start := FPosition;
repeat Inc(FPosition)
until (FPosition > Length(FHTMLStr)) or IsStartMarkupChar;
FNodeType := TEXT_NODE;
FNodeValue:= Copy(FHTMLStr, Start, FPosition - Start);
FireEvent(FOnTextNode);
end;
function THTMLReader.ReadValueNode: Boolean;
begin
Result := False;
if FState = rsBeforeValue then
begin
SkipWhiteSpaces;
if FPosition > Length(FHTMLStr) then Exit;
if not IsEqualChar then Exit;
Inc(FPosition);
SkipWhiteSpaces;
if FPosition > Length(FHTMLStr) then Exit;
if IsQuotation then
begin
FQuotation := Ord(FHTMLStr[FPosition]);
Inc(FPosition);
FState := rsInQuotedValue;
end
else FState := rsInValue;
end;
if FPosition > Length(FHTMLStr) then Exit;
if IsStartEntityChar then
begin
Result := True;
if ReadEntityNode then Exit;
Inc(FPosition);
FNodeType := ENTITY_REFERENCE_NODE;
SetNodeName('amp');
FireEvent(FOnEntityReference);
end
else Result := ReadAttrTextNode;
end;
procedure THTMLReader.ReadElementTail;
begin
SkipWhiteSpaces;
if (FPosition <= Length(FHTMLStr)) and (IsSlashChar) then
begin
FIsEmptyElement := True;
Inc(FPosition)
end;
SkipTo(WideChar(endTagChar));
FNodeType := ELEMENT_NODE;
FireEvent(FOnElementEnd);
end;
procedure THTMLReader.SetHTMLStr(const Value: string);
begin
FHTMLStr := Value;
FPosition := 1;
end;
procedure THTMLReader.SetNodeName(Value: string);
var
I: Integer;
begin
I := Pos(':', Value);
if I > 0 then
begin
FPrefix := Copy(Value, 1, I - 1);
FLocalName := Copy(Value, I + 1, Length(Value) - I);
end
else
begin
FPrefix := '';
FLocalName := Value;
end
end;
procedure THTMLReader.SkipWhiteSpaces;
begin
while (FPosition <= Length(FHTMLStr))
and (Ord(FHTMLStr[FPosition]) in whiteSpace) do Inc(FPosition);
end;
end.