- Trending Categories
- Data Structure
- Operating System
- MS Excel
- C Programming
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to update the specific node of the XML file using PowerShell?
To update the specific XML node using PowerShell, we first need to select that node with the attribute with SelectSingleNode() method.
We have below the XML file from the link stored in SampleXml.XML on C:\Temp location.
In this example, we are going to update Autor and Genre properties of the Book having attribute Id = ‘bk102’
The above commands will load the XML file and select node with attribute value ‘bk102’.
$node.genre='Non-Fiction' $node.author='Dell James' $xml.Save("C:\Temp\SampleXML.xml")
The above commands will update the genre and author property.
- Related Articles
- How to delete the specific node from the XML file using PowerShell?
- How to add an attribute to the XML file using Powershell?
- How to read the XML file in PowerShell?
- How to update the windows host file entry using PowerShell?
- How to exclude specific file names using Get-ChildItem in PowerShell?
- How to get specific nodes in xml file in Python?
- How to add a new element in the XML using PowerShell?
- How to retrieve specific file(s) information using Get-ChildItem in PowerShell?
- How to copy files of the specific extension using PowerShell?
- How to edit the CSV file using PowerShell?
- How to search in the file using PowerShell?
- How to mount the ISO file using PowerShell?
- How to dismount the ISO file using PowerShell?
- How to install the MSI file using PowerShell?
- How to get the file extension using PowerShell?