TXMLDocumentSaveToStream (Delphi)
Description
The following example uses the SaveToStream function.
Code
procedure Test_SaveToStream;
const
CFilename = 'file.xml';
var
LDocument: IXMLDocument;
LNode: IXMLNode;
LFileStream: TFileStream;
begin
LDocument := TXMLDocument.Create(nil);
LDocument.Active := True;
{ Define document content. }
LNode := LDocument.CreateNode('TestElement');
LDocument.DocumentElement := LNode;
LFileStream := TFileStream.Create(CFilename, fmCreate);
LDocument.SaveToStream(LFileStream);
LFileStream.Free;
end;
Uses
- Xml.XMLDoc.TXMLDocument.Active ( fr | de | ja )
- Xml.XMLDoc.TXMLDocument.CreateNode ( fr | de | ja )
- Xml.XMLDoc.TXMLDocument.SaveToStream ( fr | de | ja )