开发者

XML + DOM + replace text in element

开发者 https://www.devze.com 2023-01-03 04:46 出处:网络
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

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");
0

精彩评论

暂无评论...
验证码 换一张
取 消