Xml.XMLIntf.IXMLNode.Attributes

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

property Attributes[const AttrName: DOMString]: OleVariant read GetAttribute write SetAttribute;

C++

__property System::OleVariant Attributes[const System::UnicodeString AttrName] = {read=GetAttribute, write=SetAttribute};

Properties

Type Visibility Source Unit Parent
property public
Xml.XMLIntf.pas
Xml.XMLIntf.hpp
Xml.XMLIntf IXMLNode

Description

Represents the values of this node's attributes.

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.

See Also


Code Examples