In Windows Powershell, I have an XML document which contains an element whose content is text. When an element contains another element, like $x.a in the example below, it is exposed as an element, while the text only child ($x.a.b) is exposed as a string.
PS C:\> $x = [xml]"<a><b>Some Text</b></a>
PS C:\> $x.a -is [Xml.XmlElement]
True
PS C:\> $x.a.b -is [Xml.XmlElement]
False
PS C:\> $x.a.b -is [string]
True
I can understand why this is convenient, but I would like to access b as an XmlElement. Is this possible, and if so, how could I do it?