有没有一种方法可以动态解析带有JQuery的压缩XML文件? [英] Is there a way to parse a zipped XML file with JQuery on the fly?
问题描述
我想知道是否可以使用jQuery快速解析诸如example.xml.gz之类的压缩xml文件?
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.
浏览器支持Content-Encoding
= gzip
,它可以在服务器/客户端级别透明"地进行gzip压缩.
Browsers support Content-Encoding
= gzip
, which does the gzipping "transparently" at the server/client level.
您还可以提供文件(您的example.xml.gz
)中的预压缩数据,这只需要进行一些配置即可使服务器发送标头并按原样发送数据,而无需尝试重新压缩它.
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.
这篇关于有没有一种方法可以动态解析带有JQuery的压缩XML文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!