How make Safari open XML file instead of downloading it

I'm on MacOS Sierra. When I click on a link to XML file, Safari downloads it. Instead I want to view the XML right in the browser. Is there a way to accomplish this?


Solution 1:

Safari does open XML files, unless the server specifically tells Safari to download the file.
It's currently not possible to override the server's instruction to download instead of view.

Solution 2:

Just faced this problem while trying to download an XML instead of opening it in Safari.

Turned out you just have to File > Save As > Source Code For me, it was saved as pure XML.