XML Xinclude 和两个同名元素
我有两个不同的 XML 文件(确切地说是 IzPack 安装),其中有一个共同的部分。当然,我希望将这一公共部分保留在一个(外部)文件中,并将其包含到两个 XML 安装文件中。
我无法让它工作,因为看起来 XInclude 只能包含带有 XML 元素的文件。为了说明这个例子,这里有一些代码:
文件 1:
<packs>
<pack name="1">
...
</pack>
<pack name="2">
...
</pack>
<packs>
文件 2:
<packs>
<pack name="1">
...
</pack>
<pack name="2">
...
</pack>
<pack name="3">
...
</pack>
<packs>
我希望包含的文件仅包含
<pack name="1">
...
</pack>
<pack name="2">
...
</pack>
但看起来这是不可能的。我缺少什么?
更新: Xinclude 代码如下所示:
<packs>
<xi:include xmlns:xi="w3.org/2001/XInclude"; href="browserPacks.xml" parse="text"/>
I have two different XML files (IzPack installation to be exact) which a common part. Naturally, I would like to keep this common part in one (external) file and to include it into two XML installation files.
I cannot make it work as it appears that XInclude can only include files with XML elements. To illustrate the example, here is some code:
File 1:
<packs>
<pack name="1">
...
</pack>
<pack name="2">
...
</pack>
<packs>
File 2:
<packs>
<pack name="1">
...
</pack>
<pack name="2">
...
</pack>
<pack name="3">
...
</pack>
<packs>
I would like the included file to contain only
<pack name="1">
...
</pack>
<pack name="2">
...
</pack>
But it looks like it's impossible. What am I missing ?
Update:
The Xinclude code looks like:
<packs>
<xi:include xmlns:xi="w3.org/2001/XInclude"; href="browserPacks.xml" parse="text"/>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的
xinclude
是什么样子的?您是否尝试过parse=text
:所以有了这个,您应该能够让您的 file1 看起来像这样:
而您的 file2 看起来像这样:
How does your
xinclude
look like? Have you triedparse=text
:So with this, you should be able to have your file1 look like this:
and your file2 like this: