Link Search Menu Expand Document

XmlDocument.GetElementById Method

Explanation Search for the Element node from the ID attribute.

The name of the ID attribute to be searched can be changed with the IndexAttributeName property.When the IndexAttributeName property is not set, the attribute named "ID" (case sensitive) is searched as the ID attribute.

Added since Ver.4.0.0
Call format var elm = xmldoc.GetElementById( elementId )
Return value XmlElement object with the specified ID attribute.
If not found, null is returned.
Arguments String elementId The value specified for the ID attribute to be searched
Exception None
Example of use
    var domimpl = new XmlDOMImplementation;
    var res = session.Get("/test/sample.xml");
    var xmldoc = domimpl.Load(res);
    xmldoc.IndexAttributeName = "id";
    var elm = xmldoc.GetElementById("1001");
    
Related item XmlElement class
IndexAttributeName property
GetElementsByTagName, GetElementsByTagNameNS methods