I am trying to do this in powershell:
XDocument document = XDocument.Load(@"web.config"); var comments = document.Descendants("client").DescendantNodes().OfType<XComment>().ToArray(); foreach (var comment in comments) { XElement unCommented = XElement.Parse(comment.Value); comment.ReplaceWith(unCommented); }
I tried something like this:
$xDoc = [System.Xml.Linq.XDocument]::Load("web.config") [System.Collections.Generic.IEnumerable[System.Xml.Linq.XElement]] $enum = $xDoc.Descendants("client") $clients = [System.Xml.Linq.Extensions]::DescendantNodes($enum)
But I get the error message "Exception calls DescendantNodes with 1 argument: value cannot be null"
source share