xml and powershell : using XPATH

I wrote about powershell [xml] yesterady : xml and powershell

Let’s see how to use XPATH expressions in Powershell

  <emp no="1">
  <emp no="2">

With the [xml] datatype, we create a navigator :

(([xml](GC foo.xml)).psbase.createnavigator().evaluate(


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

2 Replies to “xml and powershell : using XPATH”

  1. There’s also select-xml:

    >(select-xml foo.xml -XPath ‘//emplist/emp[@no=”1″]/ename/text()’).Node.Value


Leave a Reply

Your email address will not be published.