开发者

Read XML from memory in vb.net

i want to be able to fill in a form using an XML file from the user.

how 开发者_StackOverflowcan i have them upload the XML file to read, without actually saving it to the server? is it possible?


I assume that you are talking about an ASP.NET web application here.

Most dictionaries define the term upload as something like "copy or transfer (data or a program) from one's own computer into the memory or storage of another computer". If you are uploading, you are in other words moving it to the server. I am therefore also assuming that what you are really asking for is how to upload without storing the file on the server's file system.

Files can be uploaded to a server using the FileUpload Web Server Control

The uploaded file becomes a file of type HttpPostedFile on the server.

You can read the HttpPostedFile.InputStream property [MyFileUpload.PostedFile.InputStream](e.g. with some sort of XmlReader) without involving intermediary storage of the file on the server's file system.


If you have the file stream, then you can use a XmlTextReader.

Here's an example on how to work with the XmlTextReader. In the example, they use the file name in the constructor of the XmlTextReader but you can also pass your file stream.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜