Wednesday, 18 February 2015

how to modify an xml structure using powershell and add it to a new file?



I have an xml file which I want to parse, modify the nodes and add to a new xml.



<?xml version="1.0"?>
<Objects>
<Object Type="System.String">Kapil</Object>
<Object Type="System.String">Karan</Object>
<Object Type="System.String">Harsh</Object>
<Object Type="System.String">Dheeraj</Object>
</Objects>


I want to format it using powershell to something like:



<?xml version="1.0"?>
<Persons>
<Student>
<Name>Kapil</Name>
<Name>Karan</Name>
<Name>Harsh</Name>
<Name>Dheeraj</Name>
</Student>
</Persons>

No comments:

Post a Comment