Return XML in function

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
 
L

Laurent Bugnion

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top