vb.netstreamxmldocumentopenprocess

How to open a file from a stream in Notepad


To open a file I could do this like

Process.Start(fileName)

For this it is necessary that the file exists in the file system. Now I use a XmlDocument object and want to open the content in an external program like Notepad. I save the xml content in a stream but have no idea how to show it in another program.

Dim MyXmlDocument As New XmlDocument

'do something with the document

MyXmlDocument.Save(MyXmlStream)

If it isn't possible I have to save it first and open it in a second step. I only want to avoid the saving of the file in the file system.


Solution

  • I think it is necessary to save in the file system. However, you could create a temporary file and execute a delete command when you're finished with the file. This way it does not clutter the FileSystem. The AppData folder is a good place to start.