AlittlebuginHtmlDocumentGetElementByIdofC#

I got a <code>HtmlDocument doc</code> like this:

<html>
<head>
<meta name="description" content="">
</head>
<body>
<div id="description"></div>
</body>
</html>

I tried to get the tag <code>div</code> with <code>id</code> of "description":

HtmlElement elem=doc.GetElementById("description");

But I got tag <code>meta</code> with <code>name</code> of "description" instead of <code>div</code>.


Eventually,someone on <code>StackOverFlow</code> gave me this and this:
The method <code>GetElementById</code> will return the first element with <code>id</code> or <code>name</code> equals the <code>String</code> parameter <code>id</code> of <code>GetElementById</code>.
It might because of MS gives a <code>webcontrol</code> the same name as id.

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • **2014真題Directions:Read the following text. Choose the be...
    又是夜半驚坐起閱讀 11,111評(píng)論 0 23
  • PLEASE READ THE FOLLOWING APPLE DEVELOPER PROGRAM LICENSE...
    念念不忘的閱讀 13,660評(píng)論 5 6
  • 假如我們不曾相遇 光陰依舊運(yùn)行自己的軌跡 花兒依然盛開(kāi)馨香的美麗 你不會(huì)留在我的的腦海里 假如我們不曾相遇 歲月就...
    黔北文風(fēng)閱讀 231評(píng)論 0 0
  • 最近從電視節(jié)目中聽(tīng)到了儀式感這個(gè)詞。唐藝昕在快樂(lè)大本營(yíng)節(jié)目中拿出了一個(gè)巨大的stop按鈕,她解釋的作用是可以連在電...
    四姑娘山_5510閱讀 551評(píng)論 0 2
  • zeppelin 為交互式分析查詢(xún)提供了可視化界面。 在zeppelin上使用spark NoteBook,有sp...
    breeze_lsw閱讀 5,928評(píng)論 2 5

友情鏈接更多精彩內(nèi)容