diff --git a/CHANGELOG.md b/CHANGELOG.md index 580585eb8b..16bfe3bf1d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ ### Builds - **auto-pr:** Add `CommitMessageFormat` option ([#5171](https://github.com/ScoopInstaller/Scoop/issues/5171)) +- **checkver:** Support XML default namespace ([#5191](https://github.com/ScoopInstaller/Scoop/issues/5191)) ## [v0.3.0](https://github.com/ScoopInstaller/Scoop/compare/v0.2.4...v0.3.0) - 2022-10-10 diff --git a/bin/checkver.ps1 b/bin/checkver.ps1 index 0205a36639..aeaf1914ce 100644 --- a/bin/checkver.ps1 +++ b/bin/checkver.ps1 @@ -310,12 +310,17 @@ while ($in_progress -gt 0) { # Then add them into the NamespaceManager $nsmgr = New-Object System.Xml.XmlNamespaceManager($xml.NameTable) $nsList | ForEach-Object { - $nsmgr.AddNamespace($_.LocalName, $_.Value) + if ($_.LocalName -eq 'xmlns') { + $nsmgr.AddNamespace('ns', $_.Value) + $xpath = $xpath -replace '/([^:/]+)((?=/)|(?=$))', '/ns:$1' + } else { + $nsmgr.AddNamespace($_.LocalName, $_.Value) + } } # Getting version from XML, using XPath $ver = $xml.SelectSingleNode($xpath, $nsmgr).'#text' if (!$ver) { - next "couldn't find '$xpath' in $url" + next "couldn't find '$($xpath -replace 'ns:', '')' in $url" continue } }