StefH / XPath2.Net

Lightweight XPath2 for .NET
Microsoft Public License
36 stars 14 forks source link

Call from PowerShell #14

Closed abbgrade closed 2 years ago

abbgrade commented 6 years ago

Hello,

do you ever got it working from PowerShell?

I tried it, but it seems to use XPath1.0 instead of XPath2.0

param(
    [string] $Path,
    [string] $XPath2
)

$xmlFile = New-Object System.Xml.XmlDocument
$xmlFile.Load($Path)

Add-Type -Path '.\XPath2.dll' 
$nodes = [Wmhelp.XPath2.XmlNodeExtensions]::XPath2SelectNodes($xmlFile,$XPath2)
StefH commented 6 years ago

I never used this in powershell. However, how do you see it's using version 2?

abbgrade commented 6 years ago

oh .. it works. I only had an syntax error in the XPath query.

It might be good to add a example to the readme

StefH commented 5 years ago

@abbgrade What kind of example do you mean?