[
  {
    "Id": "648530",
    "ThreadId": "266790",
    "Html": "\r\n<p>Hello,</p>\r\n<p>I have a problem to extract a specific file. I try to find a file &#65279;&#65279;with zipfile.SelectEntries, this works fine. The problem is, the file is stored within the archive with a path, but I need only the file (it is a XML-File) to open as a xmldocument to read\r\n out a tag.</p>\r\n<p>How can I extract/open the specific xml into a &#65279;system.xml.xmldocument?</p>\r\n<p>I can't find a solution for my problem :-(</p>\r\n<p>Kind regards,<br>\r\nMaximilian</p>\r\n",
    "PostedDate": "2011-07-27T13:23:09.79-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "648671",
    "ThreadId": "266790",
    "Html": "<p>Ok, so it seems to me you don't actually want the xml file, but you want to read an element from the file.</p>\r\n<p>In this case I'd suggest you call ZipEntry.OpenReader(), which gives you a readable stream for the entry in question.&nbsp; You can then use the classes in the System.Xml namespace, like System.Xml.XmlReader, to read the xml data. Call the XmlReader.Create() method passing the stream you received from ZipEntry.OpenReader(), and you should be able to read that XML data.</p>\r\n<p>The path in the ZipEntry is used only if you call ZipEntry.Extract(). Calling OpenReader() means you sidestep the path issue.</p>\r\n<p>If you actually DO want to extract the file, then you want to set the FileName property on the ZipEntry before calling Extract().&nbsp;&nbsp; Specify anything you like for the FileName; if you want a file in the local directory, then you could do myEntry.FileName = System.IO.Path.GetFileName(myEntry.FileName);</p>",
    "PostedDate": "2011-07-27T17:01:37.173-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "648766",
    "ThreadId": "266790",
    "Html": "<p>Hi Cheeso,</p>\r\n<p>thank you very much for your information, so I have changed my code to test a possibility, but now I get an exeption and I don't know why.</p>\r\n<p>Here is my test code:</p>\r\n<div style=\"color: black; background-color: white;\">\r\n<pre><span style=\"color: blue;\">Dim</span> ironCount = ironFile.SelectEntries(<span style=\"color: #a31515;\">\"TestInfo.xml\"</span>)\r\nListBox1.Items.Add(<span style=\"color: #a31515;\">\"Found entries: \"</span> &amp; ironCount.<span style=\"color: blue;\">Count</span>)\r\n\r\n<span style=\"color: blue;\">For</span> <span style=\"color: blue;\">Each</span> ironEntries <span style=\"color: blue;\">In</span> ironCount\r\n    ListBox1.Items.Add(ironEntries.FileName)\r\n\r\n    <span style=\"color: blue;\">If</span> ironEntries.UsesEncryption <span style=\"color: blue;\">Then</span>\r\n        ironEntries.Password = ZipPasswort\r\n    <span style=\"color: blue;\">End</span> <span style=\"color: blue;\">If</span>\r\n\r\n    <span style=\"color: blue;\">Dim</span> ironXmlReader <span style=\"color: blue;\">As</span> System.Xml.XmlReader = Xml.XmlReader.Create(ironEntries.OpenReader)\r\n\r\n    <span style=\"color: blue;\">Dim</span> ironXmlDoc <span style=\"color: blue;\">As</span> <span style=\"color: blue;\">New</span> System.Xml.XmlDocument\r\n    ironXmlDoc.LoadXml(ironXmlReader.Read)\r\n    ...\r\n<span style=\"color: blue;\">Next</span>\r\n</pre>\r\n</div>\r\n<pre>&nbsp;</pre>\r\n<pre>An exeption occured on \"ironXmlDoc.LoadXml...\" =&gt; ﻿﻿Data at the root level is invalid. Line 1, position 1.</pre>\r\n<pre>&nbsp;</pre>\r\n<pre>Now I have tested with a xmlstring:</pre>\r\n<pre style=\"color: black; background-color: white;\"><pre><span style=\"color: blue;\">Dim</span> xmlstring <span style=\"color: blue;\">As</span> <span style=\"color: blue;\">String</span> = <span style=\"color: #a31515;\">\"&lt;?xml version=\"\"1.0\"\" ?&gt;&lt;NewNode&gt;&lt;SecondNode&gt;&lt;LastEntry&gt;4711&lt;/LastEntry&gt;&lt;/SecondNode&gt;&lt;/NewNode&gt;\"</span>\r\nironXmlDoc.LoadXml(xmlstring)\r\n\r\n</pre>\r\n</pre>\r\n<pre>In this case I can read the Entry for &lt;LastEntry&gt;, but not if I read the same content within the file.</pre>\r\n<pre>I'm not sure where is my issue and I'm a little confused.</pre>\r\n<pre>Can anybody tell me the correct way to read out a XML-Tag within a xml file which is stored into an archive file?</pre>\r\n<pre>Kind regerads,</pre>\r\n<pre>Maximilian</pre>",
    "PostedDate": "2011-07-28T00:03:14.683-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "649363",
    "ThreadId": "266790",
    "Html": "<p>What is coming out of the stream returned by OpenReader()?&nbsp; are you sure it is valid XML?</p>\r\n<p>To diagnose this, I suggest that you store the result of the OpenReader into a stream variable, then call Read() on that stream, into a buffer.&nbsp; Print out or otherwise display the contents of what you can read from that stream. If you see something that is not an XML document, then that would explain the \"Data at the root level is invalid\" error message.</p>\r\n<p>It could be a text encoding issue, for example.&nbsp; Or it could be that it is simply not an XML file.&nbsp;&nbsp;</p>",
    "PostedDate": "2011-07-28T22:30:34.42-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "650034",
    "ThreadId": "266790",
    "Html": "<p>Hi Cheeso,</p>\n<p>thank you very much, with your information I have solved the problem:</p>\n<div style=\"color: black; background-color: white;\">\n<pre><div style=\"color: black; background-color: white;\"><pre><span style=\"color: blue;\">Dim</span> ironXmlReader <span style=\"color: blue;\">As</span> <span style=\"color: blue;\">New</span> System.IO.StreamReader(Entry.OpenReader(<span style=\"color: #a31515;\">\"VeryGoodPassword\"</span>))\r\n<span style=\"color: blue;\">Dim</span> ironXmlDocument <span style=\"color: blue;\">As</span> <span style=\"color: blue;\">New</span> System.Xml.XmlDocument\r\nironXmlDocument.LoadXml(ironXmlReader.ReadToEnd)\r\nironXmlReader.Close()\r\n\r\n</pre>\n</div>\n</pre>\n</div>\n<p>I don't know why the XmlReader not worked, but now I get the result what I need.</p>\n<p>Kind regards,<br />Maximilian</p>\n<p>&nbsp;</p>",
    "PostedDate": "2011-07-30T12:56:06.293-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "650038",
    "ThreadId": "266790",
    "Html": "<p>Ah, I'm glad to hear it.</p>",
    "PostedDate": "2011-07-30T13:14:41.19-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  }
]