System.Xml.XmlDocument.GetElementById Method

Gets the System.Xml.XmlElement with the specified ID.

Syntax

public virtual XmlElement GetElementById (string elementId)

Parameters

elementId
The attribute ID to match.

Returns

The XmlElement with the matching ID or null if no matching element is found.

Remarks

If the document has multiple elements with the matching ID, this method returns the first matching element in the document.

Note:

The DOM implementation must have information which defines which attributes are of type ID. Although attributes of type ID can be defined in either XSD schemas or DTDs, this version of the product only supports those defined in DTDs. Attributes with the name "ID" are not of type ID unless so defined in the DTD. Implementations where it is unknown whether the attributes are of type ID are expected to return null.

Requirements

Namespace: System.Xml
Assembly: System.Xml (in System.Xml.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0