I wrote about powershell [xml] yesterady : xml and powershell
Let’s see how to use XPATH expressions in Powershell
With the [xml] datatype, we create a navigator :
(([xml](GC foo.xml)).psbase.createnavigator().evaluate(
'//emplist/emp[@no="1"]/ename/text()'
))|%{$_.Value}
John
I have not been seduced by a Microsoft product since ages, but I must say I felt with love in this goody much more than in perl, cygwin, or whatever python, dos, java, vb…
It is simply great to use on the command line and can do my work.
1:0 for Microsoft
There’s also select-xml:
>(select-xml foo.xml -XPath ‘//emplist/emp[@no=”1″]/ename/text()’).Node.Value
John
Nice!!!