Noobie Help - ' in innertext after xquery

Topics: User Forum
Jan 7, 2011 at 11:27 PM

Been looking at using HTML Agility Pack for the first time but I've struck an issue that I can;t seem to find an easy answer for. For some reason I'm getting the raw html encoding inside the innertext property after a xquery and I can;t figure out why. The encoding on the document is auto and the streamencoding is UTF. Is this the reason? Simple question I'm sure is how do I get the innertext without the html encoding. Example powershell simple script is below.

 

add-type -Path .\HtmlAgilityPack.dll
$htmldoc = New-Object HtmlAgilityPack.HtmlWeb
$result = New-Object HtmlAgilityPack.HtmlDocument
$url='http://www.imdb.com/title/tt0057733/episodes'
#$url='http://www.imdb.com/title/tt0092359/episodes'
$result=$htmldoc.Load($url)
$xpath='/html/body/div/div[2]/layer/div[2]/div/div[3]/div[2]/div[2]/div/table/tr/td/h3'
$result2=$result.DocumentNode.SelectNodes($xpath)|ForEach-Object {$_.InnerText}
$result2[3]

 

 

What have I missed?