473,320 Members | 1,987 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

gzip xml.gz problem - Please Help!!!

1
Hi,

Thanks for viewing my post.

I'm having a problem trying to use gzipstrem to decompress an xml.gz. Although the xml is quite large all I'm getting is the first two product nodes.
I've tried sevral differant files and all decompress fine when manually unzipped in windows.

code:
Expand|Select|Wrap|Line Numbers
  1. FileStream fs1 = new FileStream(HttpContext.Current.Server.MapPath("BBC.xml.gz"), FileMode.Open, FileAccess.Read);
  2.  
  3. GZipStream compStream = new GZipStream(fs1, CompressionMode.Decompress);
  4. StreamReader sr = new StreamReader(compStream, Encoding.UTF8);
  5.  
  6. string x = sr.ReadToEnd();
  7. compStream.Close();
  8. compStream.Dispose();
  9. sr.Close();
  10. sr.Dispose();
  11.  
code output:

Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" encoding="ISO-8859-1"?><products><product>
  2. <product_code>0007198728</product_code>
  3. <product_name>Little Britain: The Complete Scripts and Stuff: Series Two</product_name>
  4. <brand_name></brand_name>
  5. <level1>book</level1>
  6. <level2>Comedy</level2>
  7. <level3></level3>
  8. <level4></level4>
  9. <level5></level5>
  10. <mapped_cat_level1>Books</mapped_cat_level1>
  11. <mapped_cat_level2>Humour</mapped_cat_level2>
  12. <mapped_cat_id>279</mapped_cat_id>
  13. <description>Second in the series of the hilarious published scripts of the hugely successful series. <description>
  14. <image_url_2><![CDATA[]]></image_url_2>
  15. <currency>GBP</currency>
  16. <online_price>11.49</online_price>
  17. <offline_price></offline_price>
  18. <recurring_charge></recurring_charge>
  19. <old_price></old_price>
  20. <delivery_cost></delivery_cost>
  21. <delivery_time></delivery_time>
  22. <availability></availability>
  23. <promotion_text></promotion_text>
  24. <best_seller></best_seller>
  25. <warranty></warranty>
  26. <condition></condition>
  27. <offer_type></offer_type>
  28. <keywords></keywords>
  29. <location></location>
  30. <duration></duration>
  31. <date_from></date_from>
  32. <date_to></date_to>
  33. <fieldA></fieldA>
  34. <fieldB></fieldB>
  35. <fieldC></fieldC>
  36. <fieldD></fieldD>
  37. <fieldE></fieldE>
  38. <fieldF></fieldF>
  39. <fieldG></fieldG>
  40. <fieldH></fieldH>
  41. <fieldI></fieldI>
  42. <fieldJ></fieldJ>
  43. <fieldK></fieldK>
  44. <fieldL></fieldL>
  45. <fieldM></fieldM>
  46. <fieldN></fieldN>
  47. <fieldO></fieldO>
  48. <fieldP></fieldP>
  49. <fieldQ></fieldQ>
  50. <fieldR></fieldR>
  51. <fieldT></fieldT>
  52. <fieldU></fieldU>
  53. <fieldV></fieldV>
  54. <fieldW></fieldW>
  55. <fieldX></fieldX>
  56. <fieldY></fieldY>
  57. <fieldZ></fieldZ>
  58. </product>
  59. <product>
  60. <product_code>00104</product_code>
  61. <product_name>Doctor Who: Rose & The Doctor Backpack</product_name>
  62. <brand_name></brand_name>
  63. <level1>backpack</level1>
  64. <level2>Doctor Who</level2>
  65. <level3></level3>
  66. <level4></level4>
  67. <level5></level5>
  68. <mapped_cat_level1>Bags & Belts</mapped_cat_level1>
  69. <mapped_cat_level2>Backpacks</mapped_cat_level2>
  70. <mapped_cat_id>695</mapped_cat_id>
  71. <description>Kids backpack featuring Rose and the Doctor from Season 2. Zip Opening Main Compartment. Two Velcro Closure Side Pockets. Adjustable Straps.</description>
  72. <image_url_2><![CDATA[]]></image_url_2>
  73. <currency>GBP</currency>
  74. <online_price>8.99</online_price>
  75. <offline_price></offline_price>
  76. <recurring_charge></recurring_charge>
  77. <old_price></old_price>
  78. <delivery_cost></delivery_cost>
  79. <delivery_time></delivery_time>
  80. <availability></availability>
  81. <promotion_text></promotion_text>
  82. <best_seller></best_seller>
  83. <warranty></warranty>
  84. <condition></condition>
  85. <offer_type></offer_type>
  86. <keywords></keywords>
  87. <location></location>
  88. <duration></duration>
  89. <date_from></date_from>
  90. <date_to></date_to>
  91. <fieldA></fieldA>
  92. <fieldB></fieldB>
  93. <fieldC></fieldC>
  94. <fieldD></fieldD>
  95. <fieldE></fieldE>
  96. <fieldF></fieldF>
  97. <fieldG></fieldG>
  98. <fieldH></fieldH>
  99. <fieldI></fieldI>
  100. <fieldJ></fieldJ>
  101. <fieldK></fieldK>
  102. <fieldL></fieldL>
  103. <fieldM></fieldM>
  104. <fieldN></fieldN>
  105. <fieldO></fieldO>
  106. <fieldP></fieldP>
  107. <fieldQ></fieldQ>
  108. <fieldR></fieldR>
  109. <fieldT></fieldT>
  110. <fieldU></fieldU>
  111. <fieldV></fieldV>
  112. <fieldW></fieldW>
  113. <fieldX></fieldX>
  114. <fieldY></fieldY>
  115. <fieldZ></fieldZ>
  116. </product>
  117.  
I've tried loads of different methods but all end up the same.

any ideas?

Thanks
Aug 20 '08 #1
1 1096
Curtis Rutland
3,256 Expert 2GB
Please remember to use CODE tags (the # button on the text editor) when posting any code.

MODERATOR
Aug 21 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: bmgz | last post by:
I am having problems trying to use the gzip module, I do the followig >>>import gzip >>>file = gzip.GzipFile("testfile.txt") >>>file.write() -which params does this accept?, archive name? I...
2
by: comp.lang.php | last post by:
I am simply trying to zip together selected files into a single ZIP file. Windows XP doesn't have a native process by which you can do this, so I borrowed gzip, downloaded and installed, and upon...
25
by: Xah Lee | last post by:
Python Doc Problem Example: gzip Xah Lee, 20050831 Today i need to use Python to compress/decompress gzip files. Since i've read the official Python tutorial 8 months ago, have spent 30...
1
by: khgoh | last post by:
Hi, Need help for the error "OverflowError: long int too large to convert to int" while reading a zip file content. Python version: Python 2.4.1 (#1, Sep 13 2005, 00:39:20) on linux2 Code...
4
by: Showjumper | last post by:
I tried using a custom Http Module to Gzip pages since my host wont enable GZIP via IIS. What i found was that page size actually increased - the increase came from the images. The total size of...
0
by: vampire1986 | last post by:
Hi all. I have project compress file using C#. I'm using name space IO.Compression and i saw this code on Internet but it is compress to file bigger than source file. Can you help me, please.Thanks...
2
by: syahreza.octadian | last post by:
Dear all, Please help, i have error message when i import gzip module. The error like this below: bash-3.00$ python Python 2.5 (r25:51908, Sep 20 2006, 03:46:40) on sunos5 Type "help",...
3
by: Sean Davis | last post by:
I have a set of numpy arrays which I would like to save to a gzip file. Here is an example without gzip: b=numpy.ones(1000000,dtype=numpy.uint8) a=numpy.zeros(1000000,dtype=numpy.uint8) fd =...
6
by: Giorgio Parmeggiani | last post by:
Hi I'm using the gzip compression found in WCG samples kit. It works well, but how can I set the SendTimeout and ReceiveTimeout parameters? Thank in advance Giorgio
0
by: Barak, Ron | last post by:
Thanks Gabriel, Okay, I get it: I was under the impression that the format check would be done on the open. Bye, Ron. -----Original Message----- From: Gabriel Genellina Sent: Thursday,...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.