仅使用 XSL 读取远程压缩的 xml [英] Read a remote zipped xml with just XSL

查看:16
本文介绍了仅使用 XSL 读取远程压缩的 xml的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道 XSLT 文件是否可以从位于远程 zip 文件夹中的 XML(来自工作中的服务器)读取数据,而无需任何外部处理器(撒克逊等)并且无需下载它.

I want to know if it's possible for an XSLT file to read data from an XML located within folders of a remote zip(from the server at work), without any external processors (saxon and so forth) and without downloading it.

如果做不到这一点,我将求助于仅从 zip 中读取信息...这使我想到了我的另一个(新手)问题.

Failing that, I'll resort to just reading the information from the zip... which brings me to my other (newb)issue.

我目前有一个 XSLT,它可以访问下载并提取的 XML 文件中的数据并从中获取数据,但如果不提取它,我就无法做到这一点.我已经读过,使用 Altova 和 xslt 2.0 可以使用 document() 函数从 zip 文件中读取,但到目前为止我还没有实现这一点.

I currently have an XSLT that accesses and gets the data from the downloaded and extracted XML file, but I can't do this without extracting it. I've read that with Altova and xslt 2.0 it is possible to read from within a zip file using the document() function, though, as of yet I have not been able achieve this.

这就是我尝试这样做的方式:文档('name.zip|zip/folder/folder2/iwantthis.xml')

this is how I'm trying to do it: document('name.zip|zip/folder/folder2/iwantthis.xml')

它似乎没有找到该文件.如果您向我展示我的方式的错误并引导我进入 XSLThood,我将永远感激不尽.

It just doesn't seem to find the file. I'd be almost eternally grateful if you show me the error of my ways and guide me into XSLThood.

谢谢您

推荐答案

我认为没有通用的方法可以做到这一点.

I don't think there is a general way of doing that.

但是,在许多基于 Java 的 XSLT 处理器(至少是 Saxon 和 Xalan)中,您可以使用 'jar:' URLs 来引用 zip 文件中的资源.使用 jar: 作为指向 zip 文件的 URL 的前缀,并使用 !/ 和其中的文件路径作为后缀.像这样:jar:file:///the/path/to/foo.zip!/foo.xml.

However, in many Java-based XSLT processors (at least Saxon and Xalan), you can use 'jar:' URLs to refer to resources inside zip files. Prefix the URL pointing to the zip file with jar: and suffix it with !/ and the path to the file inside it. Like this: jar:file:///the/path/to/foo.zip!/foo.xml.

要在其他处理器中实现相同的目标,您可能需要弄清楚它们是否允许注册自定义URI 处理程序"或等效的处理程序来处理您想要支持的特殊 URI.

To achieve the same in other processors, you would probably need figure out if they allow registering a custom "URI handler" or an equivalent to deal with the special URIs you want to support.

这篇关于仅使用 XSL 读取远程压缩的 xml的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆