0

I have an xml file saved and this is what I want to do,

when some one click the link that contains an xml file, I want them to ask the question if they want to save or open the file.

I know there is a way to do this using http header to send and trick your brower into using the application/octet-stream mime type, but I forgot how it was done. .. it gives me this error

The XML page cannot be displayed 
Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later. 


--------------------------------------------------------------------------------

XML document must have a top level element. Error processing resource 'file:///C:/Documents and 
hakre
  • 193,403
  • 52
  • 435
  • 836
Asim Zaidi
  • 27,016
  • 49
  • 132
  • 221

1 Answers1

3

Try adding Content-Disposition header:

Content-Disposition: attachment; filename="yourfile.xml"

And of course, the XML Content-Type header also:

Content-type: text/xml
Pablo Santa Cruz
  • 176,835
  • 32
  • 241
  • 292
  • yea but it gives me this error The XML page cannot be displayed Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later. -------------------------------------------------------------------------------- XML document must have a top level element. Error processing resource 'file:///C:/Documents and – Asim Zaidi Oct 25 '10 at 18:50
  • Sounds like an issue with your XML. – Pablo Santa Cruz Oct 25 '10 at 18:52
  • no tried with other ones...same thing happened. even the simples xml did the same thing – Asim Zaidi Oct 25 '10 at 19:00
  • Post your XML with the answer. – Pablo Santa Cruz Oct 25 '10 at 19:09