Raj Deep Alapat
01-21-2008, 11:07 AM
Hello Every body
I have a requirement to read an XML file and rewrite it. the requirement is i need to replace the data with data if it matches a particular pattern.it is just like updating the Email adresses or IP adresses.
As i am New to XML. I dont know how this can be achieved using VBScript. Sample part of my XML is
<?xml version='1.0' encoding='utf-16' standalone='yes'?>
<!--QSR Automations' RDS Network-->
<RDSNetwork.xml>
<Header>
<FileVersion>5.0</FileVersion>
<CreationDateTime>12-11-2007 16:38:11</CreationDateTime>
</Header>
<DetailData>
<Network>
<SystemType>Redundant</SystemType>
<Port>33536</Port>
<PrimaryAddress>10.16.0.20</PrimaryAddress>
<BackupAddress>10.16.0.31</BackupAddress>
<SubnetMask>255.255.255.0</SubnetMask>
<Nodes>
<Node VideoId='1' Address='10.16.0.51'/>
<Node VideoId='2' Address='10.16.0.52'/>
<Node VideoId='3' Address='10.16.0.53'/>
<Node VideoId='4' Address='10.16.0.54'/>
<Node VideoId='5' Address='10.16.0.55'/>
</Nodes>
</Network>
</DetailData>
</RDSNetwork.xml>
Here if you see i can see IP adress at Node, PrimaryAddress,BackupAddress,SubnetMask,Nodes .But this is not static. In feature i dont know where ip adress i can appear. i have to read each and every node starting from the root.If match is found i want to replace this with another IP.
Can anybody help how to achieve reading the xml file by looping and rewrite a node value if a match is found .
A sample code can really help me
Thanks in advance
Raj Deep.A
I have a requirement to read an XML file and rewrite it. the requirement is i need to replace the data with data if it matches a particular pattern.it is just like updating the Email adresses or IP adresses.
As i am New to XML. I dont know how this can be achieved using VBScript. Sample part of my XML is
<?xml version='1.0' encoding='utf-16' standalone='yes'?>
<!--QSR Automations' RDS Network-->
<RDSNetwork.xml>
<Header>
<FileVersion>5.0</FileVersion>
<CreationDateTime>12-11-2007 16:38:11</CreationDateTime>
</Header>
<DetailData>
<Network>
<SystemType>Redundant</SystemType>
<Port>33536</Port>
<PrimaryAddress>10.16.0.20</PrimaryAddress>
<BackupAddress>10.16.0.31</BackupAddress>
<SubnetMask>255.255.255.0</SubnetMask>
<Nodes>
<Node VideoId='1' Address='10.16.0.51'/>
<Node VideoId='2' Address='10.16.0.52'/>
<Node VideoId='3' Address='10.16.0.53'/>
<Node VideoId='4' Address='10.16.0.54'/>
<Node VideoId='5' Address='10.16.0.55'/>
</Nodes>
</Network>
</DetailData>
</RDSNetwork.xml>
Here if you see i can see IP adress at Node, PrimaryAddress,BackupAddress,SubnetMask,Nodes .But this is not static. In feature i dont know where ip adress i can appear. i have to read each and every node starting from the root.If match is found i want to replace this with another IP.
Can anybody help how to achieve reading the xml file by looping and rewrite a node value if a match is found .
A sample code can really help me
Thanks in advance
Raj Deep.A