[Overview][Types][Classes][Procedures and functions][Index] Reference for unit 'Laz2_XMLRead' (#lazutils)

ReadXMLFile

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

Declaration

Source position: laz2_xmlread.pas line 58

procedure ReadXMLFile(

  out ADoc: TXMLDocument;

  const AFilename: string;

  Flags: TXMLReaderFlags = []

); overload;

procedure ReadXMLFile(

  out ADoc: TXMLDocument;

  var f: Text;

  Flags: TXMLReaderFlags = []

); overload;

procedure ReadXMLFile(

  out ADoc: TXMLDocument;

  var f: file;

  Flags: TXMLReaderFlags = []

); overload;

procedure ReadXMLFile(

  out ADoc: TXMLDocument;

  f: TStream;

  Flags: TXMLReaderFlags = []

); overload;

procedure ReadXMLFile(

  out ADoc: TXMLDocument;

  f: TStream;

  const ABaseURI: string;

  Flags: TXMLReaderFlags = []

); overload;

Arguments

ADoc

  

XML document populated in the routine.

AFilename

  

File name with the XML content read in the routine.

Flags

  

Options enabled when reading the XML content.

Arguments

ADoc

  

XML document populated in the routine.

f

  

Stream with the XML content read in the routine.

Flags

  

Options enabled when reading the XML content.

Arguments

ADoc

  

XML document populated in the routine.

f

  

Stream with the XML content read in the routine.

Flags

  

Options enabled when reading the XML content.

Arguments

ADoc

  

XML document populated in the routine.

f

  

Stream with the XML content read in the routine.

Flags

  

Options enabled when reading the XML content.

Arguments

ADoc

  

XML document populated in the routine.

f

  

Stream with the XML content read in the routine.

ABaseURI

  

Base URI for XML content read in the routine.

Flags

  

Options enabled when reading the XML content.

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

TXMLDocument

TXMLReaderFlag

  

Represents options enabled when reading XML content.


Version 4.0 Generated 2025-05-03 Home