[英]Read XML from memory in vb.net
i want to be able to fill in a form using an XML file from the user. 我希望能够使用来自用户的XML文件填写表格。
how can i have them upload the XML file to read, without actually saving it to the server? 我如何让他们上载XML文件以进行读取,而无需实际将其保存到服务器? is it possible?
可能吗?
I assume that you are talking about an ASP.NET web application here. 我假设您在这里谈论的是ASP.NET Web应用程序。
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 可以使用FileUpload Web服务器控件将文件上传到服务器
The uploaded file becomes a file of type HttpPostedFile
on the server. 上载的文件成为服务器上
HttpPostedFile
类型的文件。
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. 您可以阅读
HttpPostedFile.InputStream
属性[ MyFileUpload.PostedFile.InputStream
](例如,使用某种XmlReader
),而无需在服务器的文件系统上中间存储文件。
If you have the file stream, then you can use a XmlTextReader. 如果您有文件流,则可以使用XmlTextReader。
Here's an example on how to work with the XmlTextReader. 这是有关如何使用XmlTextReader的示例 。 In the example, they use the file name in the constructor of the XmlTextReader but you can also pass your file stream.
在示例中,它们在XmlTextReader的构造函数中使用文件名,但是您也可以传递文件流。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.