[Overview][Constants][Types][Classes][Procedures and functions][Index] |
Sets the value for a named item to the specified node.
Source position: laz2_dom.pas line 402
public function TDOMNamedNodeMap.SetNamedItem( |
arg: TDOMNode |
):TDOMNode; |
arg |
|
Node with the name and value added/updated in the method. |
Node replaced in the named node map, or Nil when the node was added.
SetNamedItem is a TDOMNode function used to store the named node in arg in the node map. This may require inserting a new entry or updating an existing one.
SetNamedItem calls ValidateInsert to determine whether the node is valid, and the parent for the node map is updatable. If the response code contains a non-zero value, an EDOMError exception is raised with the response code as the error constant.
SetNamedItem calls the FindSorted method to get the ordinal position for the node in arg. If a node with the same name already exists, it is replaced. Otherwise, the node is inserted at the position needed in the sorted node list.
The node type, passed as an argument to the constructor, is used to determine whether additional actions are needed to update the node / node map. For attribute nodes (TDomAttr), the OwnerElement is cleared in the old node (when needed). The OwnerElement in the new node is set to the DOM element which owns the attribute.
The return value is set to Nil if the node in arg was added to the map. Otherwise, the return value contains the node which was replaced.
SetNamedItem is called from methods like SetAttributeNode and SetAttributeNodeNS in TDOMElement.
Use GetNamedItem to retrieve a node from the map with a specified name.
|
Performs actions to determine if an inserted attribute node is valid for its context. |
|
|
Finds a DOM Node with the specified name in the sorted container. |
|
|
Implements the DOM Element interface from the DOM specification. |
|
|
Represents the name for the DOM Attribute. |
|
|
DOM Element that owns the DOM Attribute node. |
|
|
Name for the DOM node. |
|
|
Base class for exceptions raised in DOM interface classes. |
Version 4.0 | Generated 2025-05-03 | Home |