RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
IXMLNode.Attributes Property

Represents the values of this node's attributes.

Pascal
property Attributes [const AttrName: DOMString]: OleVariant;
C++
__property OleVariant Attributes[DOMString const AttrName];

Use Attributes to read or set the values of this node's attributes. Attributes modify a node in an XML document. For example, given the node for

<Movie genre="scifi" title="Star Wars"> ... </Movie>

both genre and title are attributes of the node, with values of "scifi" and "Star Wars", respectively. 

The AttrName index gives the name of the attribute to access. In the previous example, "genre" and "title" are the names of the attributes. When setting Attributes, if you specify the name of an attribute that already exists for a node, you change that attribute's value. If you specify an attribute name that does not correspond to an existing attribute of the node, a new attribute is created.  

When reading Attributes, if you specify the name of an attribute that does not exist for the node, the value depends on the Options property of the document that contains the node. If Options includes doAttrNull, reading an attribute that does not exist for the node results in a Null Variant. When Options does not include doAttrNull, reading an attribute that does not exist results in an empty string. 

The value of Attributes is the text of the specified attribute. When setting attributes, the value string is not parsed. Any markup in the supplied value (for example, an entity reference) is treated as literal text. If you set an attribute to nil (Delphi) or NULL (C++), it is removed from this node. Note that you can set an attribute's value to an empty string. 

 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!