On 3/17/11 2:31 PM, John Harvey wrote:
> CSV is going to have a smaller footprint than xml, so if you are sending a
> flatfile, it makes more sense. I like to zip the csv files, because it cuts
> their file size by about 80%.
I think in most cases, xml would have a similar or smaller file footprint,
especially
compressed. Even if XML came out larger, it probably wouldn't be an exceedingly
huge
difference in the common case of lots of redundant data. Compare:
csv_str = """
comp_name, comp_address, comp_city, comp_state, comp_country, inv_num, inv_amt
"ABC Company", "123 Riverside Road", "Anytown", "AnyState", "US", "11928", 99.56
"ABC Company", "123 Riverside Road", "Anytown", "AnyState", "US", "12766",
199.56
"ABC Company", "123 Riverside Road", "Anytown", "AnyState", "US", "12773",
299.56
"ABC Company", "123 Riverside Road", "Anytown", "AnyState", "US", "15070",
245.22
"ABC Company", "123 Riverside Road", "Anytown", "AnyState", "US", "16090", 33.34
"ABC Company", "123 Riverside Road", "Anytown", "AnyState", "US", "16115",
1029.20
"ABC Company", "123 Riverside Road", "Anytown", "AnyState", "US", "17002", 15.54
"""
xml_str = """
<company_invoices>
<name>ABC Company</name>
<address>123 Riverside Road</address>
<city>Anytown</city>
<state>AnyState</state>
<country>US</country>
<invoices>
<invoice>
<inv_num>11928</inv_num>
<inv_amt>99.56</inv_num>
</invoice>
<invoice>
<inv_num>12766</inv_num>
<inv_amt>199.56</inv_num>
</invoice>
<invoice>
<inv_num>12773</inv_num>
<inv_amt>299.56</inv_num>
</invoice>
<invoice>
<inv_num>15070</inv_num>
<inv_amt>245.22</inv_num>
</invoice>
<invoice>
<inv_num>16090</inv_num>
<inv_amt>33.34</inv_num>
</invoice>
<invoice>
<inv_num>16115</inv_num>
<inv_amt>1029.20</inv_num>
</invoice>
<invoice>
<inv_num>17002</inv_num>
<inv_amt>15.54</inv_num>
</invoice>
</invoices>
</company_invoices>
"""
len(xml_str) : 848
len(csv_str) : 651
len(xml_zipped) : 233
len(csv_zipped) : 177
So I think you need to weigh other factors besides file size, when deciding
whether
to use CSV or XML (or something else entirely, such as YAML[1], which you
should take
a look at if you haven't seen it).
I think there are valid use-cases for each, and I still use CSV along with XML
and YAML.
Paul
[1] http://yaml.org is the official YAML site, presented in YAML.
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message:
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.