From d96e17da77554d9eb1e52519fd22ff0a2a95c345 Mon Sep 17 00:00:00 2001 From: sergei Date: Thu, 28 Oct 2010 20:23:42 +0000 Subject: [PATCH] * xmlread.pp, fixed an issue introduced by combination of r16046 and r16172: assigning doc.DocumentType only after DTD has been completely parsed prevented inner reader from parsing 2nd+ level entity references in default attribute values. This went unnoticed because of no positive tests, and was detected only by examining negative test diagnostic, namely for not-wf-sa-079 and not-wf-sa-080. git-svn-id: trunk@16248 - --- packages/fcl-xml/src/xmlread.pp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/fcl-xml/src/xmlread.pp b/packages/fcl-xml/src/xmlread.pp index 01b5a5ec4f..4ebce6bf5d 100644 --- a/packages/fcl-xml/src/xmlread.pp +++ b/packages/fcl-xml/src/xmlread.pp @@ -1347,7 +1347,9 @@ begin FXML11 := doc.InheritsFrom(TXMLDocument) and (TXMLDocument(doc).XMLVersion = '1.1'); NSPrepare; Initialize(ASource); - FDocType := TDOMDocumentTypeEx(doc.DocType); + // See comment in EntityCheck() + if FDocType = nil then + FDocType := TDOMDocumentTypeEx(doc.DocType); ParseContent; end; @@ -1722,9 +1724,13 @@ begin if not Result.FResolved then begin // To build children of the entity itself, we must parse it "out of context" + // However, care must be taken to properly pass the DTD to InnerReader. + // We now have doc.DocumentType=nil while DTD is being parsed, + // which can break parsing 2+ level entities in default attribute values. InnerReader := TXMLReader.Create(FCtrl); try InnerReader.FAttrTag := FAttrTag; + InnerReader.FDocType := FDocType; EntityToSource(Result, Src); Result.SetReadOnly(False); if Assigned(Src) then