Why does XmlDocument.GetElementById always return null?
问题 I've got some XML (valid XHTML) that looks like this: <html> <head> <script type="text/javascript"> <![CDATA[ function change_header(){ document.getElementById("myHeader").innerHTML="Nice day!"; }]]> </script> </head> <body> <h1 id="myHeader">Hello World!</h1> <button onclick="change_header()">Change text</button> </body> </html> And I'm trying to get the #myHeader node using docment.GetElementById("myHeader") but it always returns null . Why? I'm guessing it doesn't recognize the id