简体   繁体   中英

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 can 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 ](eg 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM