在内存中解析 zip 内的 XML
我有一个包含两个文件的 Zip 文件:一个 XML 和一个缩略图。我想打开 XML 文件并解析它,而无需将其提取到磁盘上。
DocumentBuilder 的解析方法之一需要一个InputStream。有没有办法获取压缩文件中XML的InputStream?我有点迷路了。我很确定 ZipInputStream 或 ZipFile 可以提供一些东西,但我无法弄清楚:/
提前谢谢您!
I have a Zip that contains two files: an XML and a thumbnail. I would like to open the XML file and parse it WITHOUT having to extract on disk.
One of DocumentBuilder's parse method requires an InputStream. Is there a way to get the InputStream of the XML in the Zipped file? I kinda got lost. I'm pretty sure ZipInputStream or ZipFile has something to offer, but I can't figure it out :/
Thank you in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
中有一些输入流类java.util.zip,不确定它们是否有帮助,但看起来很有希望,特别是 ZipInputStream。
There are some input stream classes in java.util.zip, not sure if they help, but it looks promising, especially ZipInputStream.
我相信您正在寻找这样的东西:
I believe you're looking for something like this: