Sign in Join
Wiki copytemporary

xmlwrite

Writes a DOM structure as XML data into a file or stream. It can deal both with XML files and XML fragments.

Declarations

Declarations excerpted from XMLWrite.pas.

pascal
procedure WriteXMLFile(doc: TXMLDocument; const AFileName: String); overload;
procedure WriteXMLFile(doc: TXMLDocument; var AFile: Text); overload;
procedure WriteXMLFile(doc: TXMLDocument; AStream: TStream); overload;

procedure WriteXML(Element: TDOMNode; const AFileName: String); overload;
procedure WriteXML(Element: TDOMNode; var AFile: Text); overload;
procedure WriteXML(Element: TDOMNode; AStream: TStream); overload;

Encodings

At the moment it supports only the UTF-8 output encoding. The encoding label is not written because it is optional for UTF-8.

Character escaping

The writer provides proper character escaping as required by XML:

The XML reader (in xmlread.pp) will convert these entity references back to their original characters.

Exceptions

Will raise EConvertError if any DOM node contains an unpaired UTF-16 surrogate in its name or value.

End-of-line handling

At the moment always uses line endings which are default for the target platform (#13#10 for Windows, #10 for Linux). Moreover, any #13, #10 or #13#10 in input data is treated as a single line-ending.

Notes

Back to fcl-xml overview.

See also


From the Free Pascal wiki, page "xmlwrite", as it stood on 2020-03-03 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.

Revision 1, last changed by WikiArchive .

Talk about this page

Nobody has opened a bench for this page yet. Sign in to open one.