[Up][Next] Reference for unit 'Laz2_XMLCfg' (#lazutils)

TXMLConfig Path Syntax.

Path specifiers in TXMLConfig are used to get or set a value in the XML configuration file. Its syntax describes the hierarchy of elements and attributes needed to access a value in the XML document. It consists of a relative path to a DOM node and an attribute name where the value is stored.

The path specifier should NOT include a root node (or document element name); that is assumed to be a DOM node with the name "CONFIG". Use of the root node in the specifier is invalid in TXMLConfig.

Element and attributes names in the hierarchy are separated by the '/' (Forward Slash) character. The final identifier in the path specifier is the attribute name where a value is stored in the XML document.

Lists or arrays of elements can be read /written using a path specifier that includes notation which indicates the ordinal position of the element. For example:

ACfg.SetValue('list/items/item[0]/name', 'itemA');
ACfg.SetValue('list/items/item[0]/value', 'valueA');
ACfg.SetValue('list/items/item[1]/name', 'itemB');
ACfg.SetValue('list/items/item[1]/value', 'valueB');
ACfg.SetValue('list/items/item[2]/name', 'itemC');
ACfg.SetValue('list/items/item[2]/value', 'valueC');

Results in the following XML content:

<list>
  <items>
    <item name="itemA" value="valueA"/>
    <item name="itemB" value="valueB"/>
    <item name="itemC" value="valueC"/>
  </items>
</list>
Remark: There is no overloaded variant of the SetValue method which handles writing a TRect data type in the current implementation. You must write the Top, Left, Right, and Bottom coordinates as separate calls to SetValue using the desired path.
Remark: Contrary to suggestions in source code comments, the syntax used for path specifiers in TXMLConfig is not fully XPath-compatible.

See also

TXMLConfig

  

Implements a class used to access and maintain an XML configuration data file.

TXMLConfig-Using

  

Using TXMLConfig.


Version 4.0 Generated 2025-05-03 Home