TXMLConfig-PathSyntax topic
TXMLConfig Path Syntax.
Declaration
TXMLConfig-PathSyntaxDescription
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>
See also
An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
