[Overview][Classes][Procedures and functions][Index] |
[Properties (by Name)] [Methods (by Name)] [Events (by Name)]
Implements a class used to access and maintain an XML configuration data file.
Source position: laz2_xmlcfg.pas line 42
type TXMLConfig = class(TComponent) |
||
protected |
||
Type |
||
TDomNodeArray = array of TDOMNode; |
|
Defines an array type used to store TDomNode instances. |
TNodeCache = record |
|
Advanced record type used to implement an array-based TDomNode cache. |
public |
||
Node: TDOMNode; |
|
Top-level node for the cached list of nodes. |
NodeSearchName: string; |
|
Element name used to locate a node in the cache. |
ChildrenValid: Boolean; |
|
Indicates whether cached child nodes are valid after refresh. |
Children: TDomNodeArray; |
|
Array with the named child nodes for the cached DOM node. |
NodeListName: string; |
|
Element name for a list of child nodes in the cache. |
NodeList: TDomNodeArray; |
|
Array with the list of child nodes accessed retrieved using an XPath wildcard. |
class procedure GrowArray(); |
|
Increases the capacity for the specified array of DOM nodes. |
procedure RefreshChildren; |
|
Collects and re-sorts the child nodes for the Node in the cache instance. |
procedure RefreshChildrenIfNeeded; |
|
Collects and re-sorts the child nodes for the Node in the cache instance if the child nodes have not already been refreshed. |
procedure RefreshNodeList(); |
|
Gathers child nodes with the specified node name into the NodeList for the cache instance. |
procedure RefreshNodeListIfNeeded(); |
|
Gathers child nodes with the specified node name into the NodeList if NodeListName does not contain elements with the specified name. |
function AddNodeToList; |
|
Creates and returns a new DOM node with the element name in NodeListName in the NodeList. |
|
||
end; |
||
|
Internal member with the TXMLDocument for the class instance. |
|
FModified: Boolean; |
|
Member used to indicate the configuration file has been modified. |
fDoNotLoadFromFile: Boolean; |
|
Member used to indicate that the data was created manually, and not loaded from a file or stream. |
fAutoLoadFromSource: string; |
|
Member used to store String content loaded into the configuration file. |
fPathCache: string; |
|
Not used/updated in the current implementation. |
|
Member used to cache DOM nodes accessed using paths in the class instance. |
|
procedure Loaded; override; |
|
Signals that LCL component streaming has been completed. |
function ExtendedToStr(); |
|
Converts an extended value to its representation as a String. |
function StrToExtended(); |
|
Converts the specified String value to an Extended data type. |
function SizeOfTypeInfo(); |
|
Gets the number of bytes needed to store a value using the specified RTTI type. |
function ValueWithTypeInfoToString(); |
|
Gets the string representation for the specified value as the specified type. |
function StringToValueWithTypeInfo(); |
|
Converts the specified string value to a value using the specified type. |
procedure ReadXMLFile(); virtual; |
|
Reads the XML content from the specified file into a TXMLDocument instance. |
procedure WriteXMLFile(); virtual; |
|
Writes XML configuration data in Document to the specified file name. |
procedure FreeDoc; virtual; |
|
Frees the TXMLDocument instance for the XML configuration file. |
procedure SetPathNodeCache(); |
|
Ensures a DOM node is present in the internal cache for the class instance. |
function GetCachedPathNode(); |
|
Gets a cached DOM node starting at the specified position in the cache. |
procedure InvalidateCacheTilEnd(); |
|
Removes DOM nodes from the internal cache starting at the specified ordinal position. |
function InternalFindNode(); |
|
Searches for the DOM node with the specified path, and updates the node cache. |
procedure InternalCleanNode(); |
|
Removes the specified node and all of its children from the Document. |
function FindChildNode(); |
|
Finds (and optionally caches) a child node starting at the specified index position using the specified XPath node name and position. |
public |
||
constructor Create(); |
|
Constructor for the class instance. |
constructor CreateClean(); |
|
Alternate constructor used to create the class without reading existing XML content in the specified file. |
constructor CreateWithSource(); |
|
Alternate constructor used to create the class using the XML content specified in Source. |
destructor Destroy; override; |
|
Destructor for the class instance. |
procedure Clear; |
|
Removes existing XML content in the Document property. |
procedure Flush; |
|
Forces the XML content for the configuration file to be written to Filename. |
procedure ReadFromStream(); |
|
Reads the XML content in Document from the specified stream instance. |
procedure WriteToStream(); |
|
Writes the XML content for the configuration file to the specified stream instance. |
function GetValue(); |
|
Gets the value from the DOM node at the specified path in the XML configuration file. |
function GetExtendedValue(); |
|
Gets the value for a DOM node at the specified path as an extended data type. |
procedure SetValue(); |
|
Sets the value in a DOM node at the specified path. |
procedure SetDeleteValue(); |
|
Updates or removes the value stored at the specified path. |
procedure SetExtendedValue(); |
|
Sets the value in the DOM node at the specified path using an extended data type. |
procedure SetDeleteExtendedValue(); |
|
Updates or removes the Extended value at the specified path. |
procedure DeletePath(); |
|
Deletes the DOM node at the specified path in the Document. |
procedure DeleteValue(); |
|
Deletes the value stored in the DOM node at the specified path. |
function FindNode(); |
|
Retrieves the DOM node with the specified path. |
function HasPath(); |
|
Indicates if a DOM node exists for the specified path. |
function HasChildPaths(); |
|
Indicates if the DOM node at the specified path has child nodes. |
function GetChildCount(); |
|
Gets the number of child nodes used in the DOM node at the specified path. |
function IsLegacyList(); |
|
Indicates if the specified list was written using the format from a previous LazUtils version. |
function GetListItemCount(); |
|
Gets the number of values with the specified name found in the given path. |
class function GetListItemXPath(); |
|
Gets the path specifier used to access a list item at the specified position. |
procedure SetListItemCount(); |
|
Sets the value for the Count element in a legacy version of the class. |
property Modified: Boolean; [rw] |
|
Indicates if the XML content in the class has been modified. |
procedure InvalidatePathCache; |
|
Removes cached DOM nodes for paths in the XML configuration file. |
published |
||
property Filename: string; [rw] |
|
File name used to read or write the XML content in the class instance. |
property Document: TXMLDocument; [r] |
|
XML document used for the class instance. |
property ReadFlags: TXMLReaderFlags; [rw] |
|
TXMLReaderFlags for the XML configuration file. |
property WriteFlags: TXMLWriterFlags; [rw] |
|
TXMLWriteFlags for the XML configuration file. |
end; |
|
Implements a class used to access and maintain an XML configuration data file. |
|
| | ||
| | ||
| | ||
TXMLConfig is a TComponent descendant used to store configuration data using XML format. TXMLConfig is a simpler mechanism for accessing the content in an XML document. It uses path specifiers to describe the hierarchy of elements and attribute values, instead of focusing on DOM nodes. See the TXMLConfig Path Syntax topic for more information about path specifiers in TXMLConfig.
TXMLConfig provides method used to get or set the value for a path specifier in the XML document. Overloaded methods are includes to handle values using String, Integer, Extended, TRect, or Boolean data types. See the Using TXMLConfig topic for more information about using TXMLConfig.
|
Using TXMLConfig. |
|
|
TXMLConfig Path Syntax. |
|
|
Implements an XML configuration file with RTTI support. |
Version 4.0 | Generated 2025-05-03 | Home |