[
  {
    "Id": "672260",
    "ThreadId": "272692",
    "Html": "\r\n<p>Hi All,</p>\r\n<p>I have an XML string that is compressed and stored in a database, can anyone point me in the right direction on how to decompress and get to the actual XML.\r\n<br>\r\nI have tried writing a few different solutions using the examples from the site but to no avail. It seems to be &quot;zip&quot; compressed due to the magic number header.<br>\r\nHere is the header from the string in the database below.</p>\r\n<p>0x504B0304140001000800BA552D3F6991256F4F0700007B5D00005400240055534552532F5244555155457E312F4150<br>\r\n50444154412F4C4F43414C2F54454D502F33332F7E54454D504E4734353145354132322D323745422D344342432D413<br>\r\n731312D3631433834343541373335312E5341560A</p>\r\n<p>Any information would be greatly apperciated.</p>\r\n<p>Ron Duquette</p>\r\n<p>&nbsp;</p>\r\n",
    "PostedDate": "2011-09-15T07:31:37.143-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "672361",
    "ThreadId": "272692",
    "Html": "<p>you'll need to hex-decode that string.</p>\r\n<p>Strip the first two characters.&nbsp; Then, taking 2 characters at a time, convert that string to an array of bytes. Then, you can create a MemoryStream around that array, and use the ZipFile.Read() method to read in the zipfile from that MemoryStream.</p>\r\n<div style=\"color: black; background-color: white;\">\r\n<pre><span style=\"color: green;\">// assume s is a string containing \"0x504b03040390393039....\"</span>\r\n<span style=\"color: blue;\">var</span> a = <span style=\"color: blue;\">new</span> <span style=\"color: blue;\">byte</span>[s.Length/2 -1];\r\n<span style=\"color: blue;\">for</span> (<span style=\"color: blue;\">int</span> i=0; i+2 &lt; s.Length; i+=2) \r\n{\r\n    a[i/2] = Int32.Parse(s.Substring(i+2,2), NumberStyles.AllowHexSpecifier);\r\n}\r\n\r\n<span style=\"color: blue;\">var</span> ms = <span style=\"color: blue;\">new</span> MemoryStream(a);\r\n<span style=\"color: blue;\">using</span> (<span style=\"color: blue;\">var</span> zip = ZipFile.Read(ms)) \r\n{\r\n    ....<span style=\"color: green;\">// read zipfile here</span>\r\n}\r\n</pre>\r\n</div>\r\n<p>&nbsp;</p>",
    "PostedDate": "2011-09-15T11:08:13.22-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "672387",
    "ThreadId": "272692",
    "Html": "<p>Worked like a charm. Thanks so much for your help.</p>",
    "PostedDate": "2011-09-15T12:11:09.07-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "672488",
    "ThreadId": "272692",
    "Html": "<p>No charge.</p>",
    "PostedDate": "2011-09-15T16:18:12.3-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  }
]