[fpc-devel] TDOMDocument.GetTextContent implementation seems wrong
Graeme Geldenhuys
graemeg.lists at gmail.com
Thu Oct 7 12:24:23 CEST 2010
Hi,
The current hierarchy in the dom unit is as follows
TDomNode
|
TDOMNode_WithChildren
|
TDOMDocument
Now the GetTextContent() implementation for TDOMNode_WithChildren runs
recursively through all child nodes collecting data.
...but the GetTextContent() implementation of TDomDocument simply
returns '', without calling inherited GetTextContent;
so we loose all the functionality implemented in
TDOMNode_WithChildren! Why is that?
So the following code (under FPC) simply results in returning nothing,
because FXMLDoc is a TDomDocument instance. :-/
I'm using FPC 2.4.3 here...
-----------------------------------------
destructor TXMLListener.Destroy;
var
Stream: TFileStream;
S: string;
begin
{$IFDEF FPC}
S := FXMLDoc.TextContent;
{$ELSE}
S := FXMLDoc.code;
{$ENDIF}
Stream := TFileStream.Create(FAppPath + FDocName, fmCreate or fmOpenWrite);
try
Stream.Write(PChar(S)^, Length(S));
// Stream.Write(S[1], Length(S));
finally
FreeAndNil(Stream);
end;
FStack := nil;
FreeAndNil(FXMLDoc);
inherited Destroy;
end;
-----------------------------------------
--
Regards,
- Graeme -
_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net:8080/fpgui/
More information about the fpc-devel
mailing list