mirror of
https://github.com/dfinke/ImportExcel.git
synced 2025-12-06 00:23:20 +00:00
Merge pull request #1695 from scriptingstudio/master
[Get-HtmlTable] XPath optimization
This commit is contained in:
@@ -50,7 +50,9 @@ function Get-HtmlTable {
|
|||||||
else {
|
else {
|
||||||
$h = ConvertFrom-Html -Content $r.Content
|
$h = ConvertFrom-Html -Content $r.Content
|
||||||
if ($TableIndex -is [valuetype]) { $TableIndex += 1}
|
if ($TableIndex -is [valuetype]) { $TableIndex += 1}
|
||||||
$rows = $h.SelectNodes("//table[$TableIndex]//tr")
|
$rows = try {
|
||||||
|
$h.SelectSingleNode("//table[$TableIndex]").SelectNodes(".//tr")
|
||||||
|
} catch {}
|
||||||
if (-not $rows) {Write-Warning "Could not find rows for `"//table[$TableIndex]`" in $Url ."}
|
if (-not $rows) {Write-Warning "Could not find rows for `"//table[$TableIndex]`" in $Url ."}
|
||||||
if ( -not $propertyNames) {
|
if ( -not $propertyNames) {
|
||||||
if ( $tableHeaders = $rows[$FirstDataRow].SelectNodes("th")) {
|
if ( $tableHeaders = $rows[$FirstDataRow].SelectNodes("th")) {
|
||||||
|
|||||||
Reference in New Issue
Block a user