Difference between revisions of "xmlread"
Jwdietrich (talk | contribs) |
(added definitions, structured thread) |
||
Line 1: | Line 1: | ||
Provides an XML reader, which can read XML data from a file or stream. | Provides an XML reader, which can read XML data from a file or stream. | ||
− | The parser can read files encoded in UTF-8, UTF-16 (both endianness), | + | |
− | and ISO-8859-1. | + | == Definitions == |
− | + | Definitions excerpted from xmlread.pas. | |
− | + | <source> | |
− | + | procedure ReadXMLFile(out ADoc: TXMLDocument; const AFilename: WideString); overload; | |
− | + | procedure ReadXMLFile(out ADoc: TXMLDocument; var f: Text); overload; | |
+ | procedure ReadXMLFile(out ADoc: TXMLDocument; var f: TStream); overload; | ||
+ | procedure ReadXMLFile(out ADoc: TXMLDocument; var f: TStream; const ABaseURI: WideString); overload; | ||
+ | |||
+ | procedure ReadXMLFragment(AParentNode: TDOMNode; const AFilename: WideString); overload; | ||
+ | procedure ReadXMLFragment(AParentNode: TDOMNode; var f: Text); overload; | ||
+ | procedure ReadXMLFragment(AParentNode: TDOMNode; var f: TStream); overload; | ||
+ | procedure ReadXMLFragment(AParentNode: TDOMNode; var f: TStream; const ABaseURI: WideString); overload; | ||
+ | |||
+ | procedure ReadDTDFile(out ADoc: TXMLDocument; const AFilename: WideString); overload; | ||
+ | procedure ReadDTDFile(out ADoc: TXMLDocument; var f: Text); overload; | ||
+ | procedure ReadDTDFile(out ADoc: TXMLDocument; var f: TStream); overload; | ||
+ | procedure ReadDTDFile(out ADoc: TXMLDocument; var f: TStream; const ABaseURI: WideString); overload; | ||
+ | </source> | ||
+ | |||
+ | == Encodings == | ||
+ | The parser can read files encoded in [[UTF-8]], [[UTF-16]] (both endianness), and ISO-8859-1. | ||
+ | |||
+ | == White space handling == | ||
Regarding whitespace handling: By default, whitespace directly after the beginning of a | Regarding whitespace handling: By default, whitespace directly after the beginning of a | ||
tag is discarded, and sections of the XML file which contain only whitespace and | tag is discarded, and sections of the XML file which contain only whitespace and | ||
Line 11: | Line 29: | ||
mode can be enabled by setting TDOMParser.Options.PreserveWhitespace property to | mode can be enabled by setting TDOMParser.Options.PreserveWhitespace property to | ||
True. | True. | ||
+ | |||
+ | == DTD support == | ||
+ | It supports DTD validation. Regarding entity references: The pre-defined entities "lt", "gt", "amp", "apos" and "quot", and internal entities declared in DTD, are replaced by their defined values during reading. Ability to resolve external entities is currently limited to the file system. | ||
+ | |||
Back to [[fcl-xml]] overview. | Back to [[fcl-xml]] overview. | ||
[[Category:XML]] | [[Category:XML]] | ||
+ | |||
+ | == See also == | ||
+ | [[xmlwrite]] |
Revision as of 21:54, 28 September 2015
Provides an XML reader, which can read XML data from a file or stream.
Definitions
Definitions excerpted from xmlread.pas.
procedure ReadXMLFile(out ADoc: TXMLDocument; const AFilename: WideString); overload;
procedure ReadXMLFile(out ADoc: TXMLDocument; var f: Text); overload;
procedure ReadXMLFile(out ADoc: TXMLDocument; var f: TStream); overload;
procedure ReadXMLFile(out ADoc: TXMLDocument; var f: TStream; const ABaseURI: WideString); overload;
procedure ReadXMLFragment(AParentNode: TDOMNode; const AFilename: WideString); overload;
procedure ReadXMLFragment(AParentNode: TDOMNode; var f: Text); overload;
procedure ReadXMLFragment(AParentNode: TDOMNode; var f: TStream); overload;
procedure ReadXMLFragment(AParentNode: TDOMNode; var f: TStream; const ABaseURI: WideString); overload;
procedure ReadDTDFile(out ADoc: TXMLDocument; const AFilename: WideString); overload;
procedure ReadDTDFile(out ADoc: TXMLDocument; var f: Text); overload;
procedure ReadDTDFile(out ADoc: TXMLDocument; var f: TStream); overload;
procedure ReadDTDFile(out ADoc: TXMLDocument; var f: TStream; const ABaseURI: WideString); overload;
Encodings
The parser can read files encoded in UTF-8, UTF-16 (both endianness), and ISO-8859-1.
White space handling
Regarding whitespace handling: By default, whitespace directly after the beginning of a tag is discarded, and sections of the XML file which contain only whitespace and no other text content are discarded as well. However, whitespace-preserving mode can be enabled by setting TDOMParser.Options.PreserveWhitespace property to True.
DTD support
It supports DTD validation. Regarding entity references: The pre-defined entities "lt", "gt", "amp", "apos" and "quot", and internal entities declared in DTD, are replaced by their defined values during reading. Ability to resolve external entities is currently limited to the file system.
Back to fcl-xml overview.