powershell xml 要素取り出し
powershellでxml要素取り出し
基本は doc に対して
-> firstchild
-> childnodes
-> foreach
-> $_.name と$_.innertext
例)
mono.xml の内容
<top>
<iro>ao</iro>
<omosa>10</omosa>
</top>
$doc = [xml](get-content "mono.xml")
$root = $doc.firstchild
$children = $root.ChildNodes()
$children | foreach { write-host $_.name $_.innertext }
出力が
iro ao
omosa 10
こんな感じ