yael
yael

Reputation: 2913

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" />

Upvotes: 0

Views: 409

Answers (2)

Garett
Garett

Reputation: 16828

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"

Upvotes: 1

Thariama
Thariama

Reputation: 50832

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

Upvotes: 1

Related Questions