I use DotNet Zip. The desired file is placed in the variable ZipEntry. Then you need to unzip it and load it into an XmlDocument. I tried this:

MemoryStream ms = new MemoryStream(); zipEntry.Extract(ms); doc.Load(ms); 

But the compiler says that there is no root element. If you first save the stream to disk and give the path to the file to the Load method, then everything loads fine. Simply it would be desirable to push at once from a flow in DocumentXml and further to work. Tell me why it does not work?



    1 answer 1

    I didn’t work with DotNet Zip, I don’t know the features of the zipEntry.Extract method, but maybe after uploading it’s worth moving the stream position to the beginning?

    • Pancake! For sure! Already many times on this when working with the MemoryStream come across: D Thank you! - Donil