I'm trying to use the HTML Agility pack and PowerShell to get data from web-sites. The problem is that after I try to load the html through HtmlDocument.LoadHtml () or HtmlDocument.Load(filename) , the result is null. Here's a very simple example showing the problem:
$htmlstring = @' <html> <head> <title>The new way</title> </head> <body> This is a test </body> </html> '@ add-type -Path E:\prof\computing\Web\HtmlAgilityPack.1.4.0\HtmlAgilityPack.dll $doc = New-Object HtmlAgilityPack.HtmlDocument $result = $doc.LoadHtml($htmlstring) if ($result -eq $null) {"null returned"}else{"non-null return"}
I thought I had this working but even my test data html files aren't loading now.
I've been using PowerGui (now v3.2) for most of my development but the example produces exactly the same results when run on PowerShell ISI.
Any ideas?
Thanks
Mike