Lazy Diary @ Hatena Blog

PowerShell / Java / miscellaneous things about software development, Tips & Gochas. CC BY-SA 4.0/Apache License 2.0

Entries from 2017-10-26 to 1 day

How to get a #text in XML even if the tag doesn't have attributes

Background: In PowerShell (even in C# or VB.NET?), you can get a body of the tag (text content) with '#text#' property. > $xml = New-Object System.Xml.XmlDocument > $xml.LoadXml('<a><b id="1">foo</b></a>') > $xml.SelectNodes('//a').b.'#text' foo Problem: If a …