From 6ccb76976836ee2bf0c0a8ebd4d06c66ea2476a7 Mon Sep 17 00:00:00 2001 From: sergei Date: Sat, 19 Feb 2011 18:14:08 +0000 Subject: [PATCH] * xmlread.pp, the end of root element is now detected without involving DOM nodes. git-svn-id: trunk@16942 - --- packages/fcl-xml/src/xmlread.pp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/fcl-xml/src/xmlread.pp b/packages/fcl-xml/src/xmlread.pp index 1f0b5892c8..501aa55b89 100644 --- a/packages/fcl-xml/src/xmlread.pp +++ b/packages/fcl-xml/src/xmlread.pp @@ -291,6 +291,7 @@ type FIntSubset: TWideCharBuf; FAttrTag: Cardinal; FDTDProcessed: Boolean; + FFragmentMode: Boolean; FToken: TXMLToken; FNext: TXMLToken; FCurrEntity: TEntityDecl; @@ -1318,6 +1319,7 @@ begin FNesting := 0; FCurrNode := @FNodeStack[0]; FCursorStack[0] := doc; + FFragmentMode := False; NSPrepare; Initialize(ASource); if FSource.FXMLVersion <> xmlVersionUnknown then @@ -1345,6 +1347,7 @@ begin FNesting := 0; FCurrNode := @FNodeStack[0]; FCursorStack[0] := AOwner as TDOMNode_WithChildren; + FFragmentMode := True; FXML11 := doc.InheritsFrom(TXMLDocument) and (TXMLDocument(doc).XMLVersion = '1.1'); NSPrepare; Initialize(ASource); @@ -3131,9 +3134,6 @@ end; procedure TXMLReader.DoEndElement; begin - if (FNesting = 1) and (FCursorStack[0] = doc) then - FState := rsEpilog; - if FValidate and FValidators[FNesting].Incomplete then ValidationError('Element ''%s'' is missing required sub-elements', [FNodeStack[FNesting].FQName^.Key], -1); end; @@ -3695,6 +3695,8 @@ end; procedure TXMLReader.PopVC; begin + if (FNesting = 1) and (not FFragmentMode) then + FState := rsEpilog; if FNesting > 0 then Dec(FNesting); FCurrNode := @FNodeStack[FNesting]; UpdateConstraints;