Using an XML document in powershell how can you remove an attribute string from an element? Not looking for a solution that uses Get-Content, but one that uses:
$xml = New-Object XML
$xml.Load("$pathToFile")
How can I use the XML DOM to remove the attribute?
In the example XML below, lets say that I want to remove the lang attribute from the title node for all entries. Note that the value of lang can be different as in the example below, thus <title lang="en-US"> and <title lang="en-GB"> would both become <title>
Example XML:
<?xmlversion="1.0"encoding="UTF-8"?>
<bookstore>
<bookcategory="cooking">
<titlelang="en-US">Everyday Italian</title>
<author>Giada De Laurentiis</author>
<year>2005</year>
<price>30.00</price>
</book>
<bookcategory="children">
<titlelang="en-GB">Harry Potter</title>
<author>J K. Rowling</author>
<year>2005</year>
<price>29.99</price>
</book>
</bookstore>