XML + DOM + replace text in element
For the following XML:
<NET ID="10.10.10.10, 255.255.255.0" />
I need to replace the text开发者_如何学编程 10.10.10.10, 255.255.255.0
with 192.9.1.1, 255.0.0.0 by VB + DOM script
so the final line in the XML should be
<NET ID="192.9.1.1, 255.0.0.0" />
I assume this is related to your previous question. You can do it like this:
objRoot.selectSingleNode("./names/NET1").attributes.getNamedItem("ID").text = "192.9.1.1, 255.0.0.0"
Is this what you are looking for?
document.getElementById("10.10.10.10, 255.255.255.0").setAttribute("id","192.9.1.1, 255.0.0.0");
精彩评论