|
@@ -294,8 +294,7 @@ type
|
|
FDocType: TDOMDocumentTypeEx; // a shortcut
|
|
FDocType: TDOMDocumentTypeEx; // a shortcut
|
|
FPEMap: THashTable;
|
|
FPEMap: THashTable;
|
|
FGEMap: THashTable;
|
|
FGEMap: THashTable;
|
|
- FIDRefs: TFPList;
|
|
|
|
- FNotationRefs: TFPList;
|
|
|
|
|
|
+ FForwardRefs: TFPList;
|
|
FCurrContentType: TElementContentType;
|
|
FCurrContentType: TElementContentType;
|
|
FSaViolation: Boolean;
|
|
FSaViolation: Boolean;
|
|
FDTDStartPos: PWideChar;
|
|
FDTDStartPos: PWideChar;
|
|
@@ -337,8 +336,8 @@ type
|
|
procedure StoreLocation(out Loc: TLocation);
|
|
procedure StoreLocation(out Loc: TLocation);
|
|
function ValidateAttrSyntax(AttrDef: TAttributeDef; const aValue: WideString): Boolean;
|
|
function ValidateAttrSyntax(AttrDef: TAttributeDef; const aValue: WideString): Boolean;
|
|
procedure ValidateAttrValue(Attr: TDOMAttr; const aValue: WideString);
|
|
procedure ValidateAttrValue(Attr: TDOMAttr; const aValue: WideString);
|
|
- procedure AddForwardRef(aList: TFPList; Buf: PWideChar; Length: Integer);
|
|
|
|
- procedure ClearRefs(aList: TFPList);
|
|
|
|
|
|
+ procedure AddForwardRef(Buf: PWideChar; Length: Integer);
|
|
|
|
+ procedure ClearForwardRefs;
|
|
procedure ValidateIdRefs;
|
|
procedure ValidateIdRefs;
|
|
procedure StandaloneError(LineOffs: Integer = 0);
|
|
procedure StandaloneError(LineOffs: Integer = 0);
|
|
procedure CallErrorHandler(E: EXMLReadError);
|
|
procedure CallErrorHandler(E: EXMLReadError);
|
|
@@ -1240,8 +1239,7 @@ begin
|
|
inherited Create;
|
|
inherited Create;
|
|
BufAllocate(FName, 128);
|
|
BufAllocate(FName, 128);
|
|
BufAllocate(FValue, 512);
|
|
BufAllocate(FValue, 512);
|
|
- FIDRefs := TFPList.Create;
|
|
|
|
- FNotationRefs := TFPList.Create;
|
|
|
|
|
|
+ FForwardRefs := TFPList.Create;
|
|
FAttrChunks := TFPList.Create;
|
|
FAttrChunks := TFPList.Create;
|
|
|
|
|
|
// Set char rules to XML 1.0
|
|
// Set char rules to XML 1.0
|
|
@@ -1284,15 +1282,13 @@ begin
|
|
FSource.Free;
|
|
FSource.Free;
|
|
FPEMap.Free;
|
|
FPEMap.Free;
|
|
FGEMap.Free;
|
|
FGEMap.Free;
|
|
- ClearRefs(FNotationRefs);
|
|
|
|
- ClearRefs(FIDRefs);
|
|
|
|
|
|
+ ClearForwardRefs;
|
|
FNsAttHash.Free;
|
|
FNsAttHash.Free;
|
|
FNSHelper.Free;
|
|
FNSHelper.Free;
|
|
if FOwnsDoctype then
|
|
if FOwnsDoctype then
|
|
FDocType.Free;
|
|
FDocType.Free;
|
|
|
|
|
|
- FNotationRefs.Free;
|
|
|
|
- FIDRefs.Free;
|
|
|
|
|
|
+ FForwardRefs.Free;
|
|
FAttrChunks.Free;
|
|
FAttrChunks.Free;
|
|
inherited Destroy;
|
|
inherited Destroy;
|
|
end;
|
|
end;
|
|
@@ -2404,7 +2400,7 @@ begin
|
|
ValidationError('Duplicate token in NOTATION attribute declaration',[], FName.Length);
|
|
ValidationError('Duplicate token in NOTATION attribute declaration',[], FName.Length);
|
|
|
|
|
|
if not DiscardIt then
|
|
if not DiscardIt then
|
|
- AddForwardRef(FNotationRefs, FName.Buffer, FName.Length);
|
|
|
|
|
|
+ AddForwardRef(FName.Buffer, FName.Length);
|
|
SkipWhitespace;
|
|
SkipWhitespace;
|
|
until not CheckForChar('|');
|
|
until not CheckForChar('|');
|
|
ExpectChar(')');
|
|
ExpectChar(')');
|
|
@@ -2519,7 +2515,7 @@ begin
|
|
ExpectWhitespace;
|
|
ExpectWhitespace;
|
|
StoreLocation(FTokenStart);
|
|
StoreLocation(FTokenStart);
|
|
Entity.FNotationName := ExpectName;
|
|
Entity.FNotationName := ExpectName;
|
|
- AddForwardRef(FNotationRefs, FName.Buffer, FName.Length);
|
|
|
|
|
|
+ AddForwardRef(FName.Buffer, FName.Length);
|
|
// SAX: DTDHandler.UnparsedEntityDecl(...);
|
|
// SAX: DTDHandler.UnparsedEntityDecl(...);
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
@@ -3180,34 +3176,34 @@ begin
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TXMLReader.AddForwardRef(aList: TFPList; Buf: PWideChar; Length: Integer);
|
|
|
|
|
|
+procedure TXMLReader.AddForwardRef(Buf: PWideChar; Length: Integer);
|
|
var
|
|
var
|
|
w: PForwardRef;
|
|
w: PForwardRef;
|
|
begin
|
|
begin
|
|
New(w);
|
|
New(w);
|
|
SetString(w^.Value, Buf, Length);
|
|
SetString(w^.Value, Buf, Length);
|
|
w^.Loc := FTokenStart;
|
|
w^.Loc := FTokenStart;
|
|
- aList.Add(w);
|
|
|
|
|
|
+ FForwardRefs.Add(w);
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TXMLReader.ClearRefs(aList: TFPList);
|
|
|
|
|
|
+procedure TXMLReader.ClearForwardRefs;
|
|
var
|
|
var
|
|
I: Integer;
|
|
I: Integer;
|
|
begin
|
|
begin
|
|
- for I := 0 to aList.Count-1 do
|
|
|
|
- Dispose(PForwardRef(aList.List^[I]));
|
|
|
|
- aList.Clear;
|
|
|
|
|
|
+ for I := 0 to FForwardRefs.Count-1 do
|
|
|
|
+ Dispose(PForwardRef(FForwardRefs.List^[I]));
|
|
|
|
+ FForwardRefs.Clear;
|
|
end;
|
|
end;
|
|
|
|
|
|
procedure TXMLReader.ValidateIdRefs;
|
|
procedure TXMLReader.ValidateIdRefs;
|
|
var
|
|
var
|
|
I: Integer;
|
|
I: Integer;
|
|
begin
|
|
begin
|
|
- for I := 0 to FIDRefs.Count-1 do
|
|
|
|
- with PForwardRef(FIDRefs.List^[I])^ do
|
|
|
|
|
|
+ for I := 0 to FForwardRefs.Count-1 do
|
|
|
|
+ with PForwardRef(FForwardRefs.List^[I])^ do
|
|
if Doc.GetElementById(Value) = nil then
|
|
if Doc.GetElementById(Value) = nil then
|
|
DoErrorPos(esError, Format('The ID ''%s'' does not match any element', [Value]), Loc);
|
|
DoErrorPos(esError, Format('The ID ''%s'' does not match any element', [Value]), Loc);
|
|
- ClearRefs(FIDRefs);
|
|
|
|
|
|
+ ClearForwardRefs;
|
|
end;
|
|
end;
|
|
|
|
|
|
procedure TXMLReader.ProcessDefaultAttributes(ElDef: TElementDecl);
|
|
procedure TXMLReader.ProcessDefaultAttributes(ElDef: TElementDecl);
|
|
@@ -3387,7 +3383,7 @@ begin
|
|
EndPos := StartPos;
|
|
EndPos := StartPos;
|
|
while (EndPos <= L) and (aValue[EndPos] <> #32) do
|
|
while (EndPos <= L) and (aValue[EndPos] <> #32) do
|
|
Inc(EndPos);
|
|
Inc(EndPos);
|
|
- AddForwardRef(FIDRefs, @aValue[StartPos], EndPos-StartPos);
|
|
|
|
|
|
+ AddForwardRef(@aValue[StartPos], EndPos-StartPos);
|
|
StartPos := EndPos + 1;
|
|
StartPos := EndPos + 1;
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
@@ -3427,11 +3423,11 @@ var
|
|
I: Integer;
|
|
I: Integer;
|
|
begin
|
|
begin
|
|
if FValidate then
|
|
if FValidate then
|
|
- for I := 0 to FNotationRefs.Count-1 do
|
|
|
|
- with PForwardRef(FNotationRefs[I])^ do
|
|
|
|
|
|
+ for I := 0 to FForwardRefs.Count-1 do
|
|
|
|
+ with PForwardRef(FForwardRefs[I])^ do
|
|
if FDocType.Notations.GetNamedItem(Value) = nil then
|
|
if FDocType.Notations.GetNamedItem(Value) = nil then
|
|
DoErrorPos(esError, Format('Notation ''%s'' is not declared', [Value]), Loc);
|
|
DoErrorPos(esError, Format('Notation ''%s'' is not declared', [Value]), Loc);
|
|
- ClearRefs(FNotationRefs);
|
|
|
|
|
|
+ ClearForwardRefs;
|
|
end;
|
|
end;
|
|
|
|
|
|
procedure TXMLReader.DoText(ch: PWideChar; Count: Integer; Whitespace: Boolean);
|
|
procedure TXMLReader.DoText(ch: PWideChar; Count: Integer; Whitespace: Boolean);
|