xmlread: what changed
Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.
Title: xmlread
| Old | New | Line | |
|---|---|---|---|
| 1 | + | Provides an XML reader, which can read XML data from a file or stream. The data is stored in a [[TXMLDocument]]. | |
| 2 | + | ||
| 3 | + | ## Declarations | |
| 4 | + | ||
| 5 | + | Declarations excerpted from xmlread.pas. | |
| 6 | + | ||
| 7 | + | ``` pascal | |
| 8 | + | procedure ReadXMLFile(out ADoc: TXMLDocument; const AFilename: WideString); overload; | |
| 9 | + | procedure ReadXMLFile(out ADoc: TXMLDocument; var f: Text); overload; | |
| 10 | + | procedure ReadXMLFile(out ADoc: TXMLDocument; var f: TStream); overload; | |
| 11 | + | procedure ReadXMLFile(out ADoc: TXMLDocument; var f: TStream; const ABaseURI: WideString); overload; | |
| 12 | + | ||
| 13 | + | procedure ReadXMLFragment(AParentNode: TDOMNode; const AFilename: WideString); overload; | |
| 14 | + | procedure ReadXMLFragment(AParentNode: TDOMNode; var f: Text); overload; | |
| 15 | + | procedure ReadXMLFragment(AParentNode: TDOMNode; var f: TStream); overload; | |
| 16 | + | procedure ReadXMLFragment(AParentNode: TDOMNode; var f: TStream; const ABaseURI: WideString); overload; | |
| 17 | + | ||
| 18 | + | procedure ReadDTDFile(out ADoc: TXMLDocument; const AFilename: WideString); overload; | |
| 19 | + | procedure ReadDTDFile(out ADoc: TXMLDocument; var f: Text); overload; | |
| 20 | + | procedure ReadDTDFile(out ADoc: TXMLDocument; var f: TStream); overload; | |
| 21 | + | procedure ReadDTDFile(out ADoc: TXMLDocument; var f: TStream; const ABaseURI: WideString); overload; | |
| 22 | + | ``` | |
| 23 | + | ||
| 24 | + | ## Encodings | |
| 25 | + | ||
| 26 | + | The parser can read files encoded in [[UTF-8]], [[UTF-16]] (both endianness), and ISO-8859-1. | |
| 27 | + | ||
| 28 | + | ## White space handling | |
| 29 | + | ||
| 30 | + | 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. | |
| 31 | + | ||
| 32 | + | ## DTD support | |
| 33 | + | ||
| 34 | + | 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. | |
| 35 | + | ||
| 36 | + | Back to [[fcl-xml]] overview. | |
| 37 | + | ||
| 38 | + | ## See also | |
| 39 | + | ||
| 40 | + | - [[xmlwrite]] | |
| 41 | + | ||
| 42 | + | --- | |
| 43 | + | *From the Free Pascal wiki, page "xmlread", 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](/wiki-contact).* |
