当尝试使用powershell解析xml文件中的各种数据时,能够看到各种元素实际上是什么,进行调试等会很有用。所以,如果我有这样的事情:
[xml]$xmldoc = Get-Content doc.xml
$node = $xmldoc.SelectSingleNode("contents/some/path/items/item[name='itemname']")
$items = $xmldoc.contents.some.path.items
write-host "items = [${items}], node = [${node}]"
Run Code Online (Sandbox Code Playgroud)
我希望能够看到$ items和$ node的内容,但是我得到的只是System.Xml.XmlDocument或System.Xml.XmlElement。当我尝试使用items.Value或items.InnerText时,它们显示为空,那么如何打印这些元素的实际文本?
在 Visual Studio 中尝试编译时,我得到一个 static_assert,但是当我单击该错误时,它需要断言本身而不是有问题的行。
如何找出哪一行触发了static_assert?