Sign in Join
FPDoc Onlineexperiment

ReadXMLFile procedure

In unit Laz2_XMLRead

Reads the content of an XML file into the specified XML document.

Declaration

pascal
procedure ReadXMLFile(out ADoc: TXMLDocument; const AFilename: string; 
 Flags: TXMLReaderFlags=[]); overload

Description

ReadXMLFile is an overloaded procedure used to read the XML content from the specified source. Overloaded variants are provided which use a file name, a Text type, a File type, or a Stream as the input source.

When using the variant that specifies AFileName, the parameter must represent a valid file name. An exception is raised if AFileName does not exist on the local file system. The value in AFileName is converted to a File URI and used as the BaseURI in the XML Document.

The Flags parameter contains TXMLReaderFlag values enabled in the routine. The default value for the parameter is an empty set ([]), and indicates that no options are enabled by default. Values in the Flags parameter control the behavior enabled when XML content is de-serialized. Please note that use of the xrfAllowSpecialCharsInAttributeValue flag allows characters which are not normally allowed in an XML document. An XML document created with this option enabled (and used) cannot be exchanged and processed by an external validating XML processor. Technically, the XML document is invalid. WriteXML and WriteXMLFile in LazUtils will accept and process these values when configured to do so.

ReadXMLFile creates a TXMLReader instance that is used to read, parse, and store the values from the XML input source using its ProcessXML method. Values read in the routine are stored in the TXMLDocument instance in ADoc.

See also

An experiment, built from Lazarus main 2dfa93c66e of 10-22-2026. Not the official Lazarus documentation.