mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-20 16:09:31 +02:00
* Flag undeclared elements with ContentType = ctUndeclared, it's much more self-documenting than the
mysterious HasElementDecl. git-svn-id: trunk@13266 -
This commit is contained in:
parent
b47650960e
commit
f31048dc01
@ -289,6 +289,7 @@ type
|
||||
TXMLReadState = (rsProlog, rsDTD, rsRoot, rsEpilog);
|
||||
|
||||
TElementContentType = (
|
||||
ctUndeclared,
|
||||
ctAny,
|
||||
ctEmpty,
|
||||
ctMixed,
|
||||
@ -458,7 +459,6 @@ type
|
||||
public
|
||||
FExternallyDeclared: Boolean;
|
||||
ContentType: TElementContentType;
|
||||
HasElementDecl: Boolean;
|
||||
IDAttr: TDOMAttrDef;
|
||||
NotationAttr: TDOMAttrDef;
|
||||
RootCP: TContentParticle;
|
||||
@ -2246,10 +2246,10 @@ var
|
||||
ExtDecl: Boolean;
|
||||
begin
|
||||
CP := nil;
|
||||
Typ := ctAny; // satisfy compiler
|
||||
Typ := ctUndeclared; // satisfy compiler
|
||||
ExpectWhitespace;
|
||||
ElDef := FindOrCreateElDef;
|
||||
if ElDef.HasElementDecl then
|
||||
if ElDef.ContentType <> ctUndeclared then
|
||||
ValidationError('Duplicate declaration of element ''%s''', [ElDef.TagName], FName.Length);
|
||||
|
||||
ExtDecl := FSource.DTDSubsetType <> dsInternal;
|
||||
@ -2306,9 +2306,8 @@ begin
|
||||
else
|
||||
FatalError('Invalid content specification');
|
||||
// SAX: DeclHandler.ElementDecl(name, model);
|
||||
if not ElDef.HasElementDecl then
|
||||
if ElDef.ContentType = ctUndeclared then
|
||||
begin
|
||||
ElDef.HasElementDecl := True;
|
||||
ElDef.FExternallyDeclared := ExtDecl;
|
||||
ElDef.ContentType := Typ;
|
||||
ElDef.RootCP := CP;
|
||||
@ -2893,7 +2892,7 @@ begin
|
||||
|
||||
// Find declaration for this element
|
||||
ElDef := TDOMElementDef(ElName^.Data);
|
||||
if (ElDef = nil) or (not ElDef.HasElementDecl) then
|
||||
if (ElDef = nil) or (ElDef.ContentType = ctUndeclared) then
|
||||
ValidationError('Using undeclared element ''%s''',[ElName^.Key], FName.Length);
|
||||
|
||||
// Check if new element is allowed in current context
|
||||
@ -3485,7 +3484,7 @@ begin
|
||||
else
|
||||
FFailed := True; // used to prevent extra error at the end of element
|
||||
end;
|
||||
// ctAny: returns True by default
|
||||
// ctAny, ctUndeclared: returns True by default
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user