I was wondering if there is a way to parse a zipped xml file such as example.xml.gz with jQuery on the fly?
The reason is the file is huge and effects the performance if we call a request to the unzipped file. Any tips?
I was wondering if there is a way to parse a zipped xml file such as example.xml.gz with jQuery on the fly?
The reason is the file is huge and effects the performance if we call a request to the unzipped file. Any tips?
You could let the browser handle the decompression.
Browsers support Content-Encoding
= gzip
, which does the gzipping "transparently" at the server/client level.
You can serve pre-gzipped data from a file (your example.xml.gz
) as well, this just requires some configuration to make the server send the header and send the data as-is, not trying to recompress it.
I'm not really sure using a compressed xml is the right way here. Javascript need the uncompressed file to parse it so Javascript must uncompress your file first and you lost the interest of using compressed file. Maybe it's better to use an uncompressed XML and set your server to use compression on data transfer (if the transfer is the pb why you want compressed xml).
JQuery is mainly a DOM manipulation library and is not suited for handling binary file formats.
Can't you just digest the xml server-side and only serve what's needed client-side?