EDN Admin
Well-known member
Hi,
I have a very simple code:
<div style="color:black; background-color:white
<pre><span style="color:green // This code line returns null
<span style="color:blue var element = xmlDocument.GetElementById(<span style="color:#a31515 "myElementId");
<span style="color:green // And this one returns element with ID myElementId
element = xmlDocument.GetElementsByTagName(<span style="color:#a31515 "*").OfType<XmlElement>().FirstOrDefault(element => element.HasAttribute(<span style="color:#a31515 "id") && element.GetAttribute(<span style="color:#a31515 "id") == <span style="color:#a31515 "myElementId");
[/code]
<br/>
What is the reason of such GetElementById behavior? Why it can not find element with myElementId ID?<br/>
<br/>
<br/>
View the full article
I have a very simple code:
<div style="color:black; background-color:white
<pre><span style="color:green // This code line returns null
<span style="color:blue var element = xmlDocument.GetElementById(<span style="color:#a31515 "myElementId");
<span style="color:green // And this one returns element with ID myElementId
element = xmlDocument.GetElementsByTagName(<span style="color:#a31515 "*").OfType<XmlElement>().FirstOrDefault(element => element.HasAttribute(<span style="color:#a31515 "id") && element.GetAttribute(<span style="color:#a31515 "id") == <span style="color:#a31515 "myElementId");
[/code]
<br/>
What is the reason of such GetElementById behavior? Why it can not find element with myElementId ID?<br/>
<br/>
<br/>
View the full article