Return XML in function

  • Thread starter Thread starter shapper
  • Start date Start date
S

shapper

Hello,

I have a function which is transforming a XML file into another XML
file using a XSL file.

Function GetXML()
...
Dim myXml As XmlDocument = New XmlDocument
...
myXsl.Transform(myXml, myXslArguments,
HttpContext.Current.Response.Output)
...

End Function

Instead of displaying, in the browser, the resulting XML I want to
return it so I can display it later in the browser as a XML document.

How can I do this?

Thanks,

Miguel
 
Hi,
Hello,

I have a function which is transforming a XML file into another XML
file using a XSL file.

Function GetXML()
...
Dim myXml As XmlDocument = New XmlDocument
...
myXsl.Transform(myXml, myXslArguments,
HttpContext.Current.Response.Output)
...

End Function

Instead of displaying, in the browser, the resulting XML I want to
return it so I can display it later in the browser as a XML document.

How can I do this?

Thanks,

Miguel

Unfortunately, I don't think you can guarantee the way in which the
browser will handle the XML file.

By setting a Response.ContentType to "text/xml", you tell the browser
what it must expect to be found in the response. However, the user can
decide what he wants to do with XML files (or any other file), open then
in the browser or download them to save them.

If you want to make sure that the open/save dialog is displayed, I think
that you should zip the XML file (for example using the excellent and
free SharpZipLib) and send back the zipped file.

HTH,
Laurent
 
Back
Top