'Download XML File with Powershell

when i attempt to download a xml file, i get not the xml content but den html code of the site.

$WebClient = New-Object System.Net.WebClient
$WebClient.DownloadFile("https://jira.issueviews:issue-xml/HELP-1141/HELP-1141.xml","C:\test.xml")

Select-Xml -Path ".\test.xml" -XPath '/channel/title' | ForEach-Object { $_.Node.name }

What is wrong ?

lg Joachim



Solution 1:[1]

What's about using Invoke-RestMethod?

$Uri = "https://myurltothexml.com/foobar.xml"
(Invoke-RestMethod -Uri $Uri).OuterXml

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Gill-Bates