[英]Can I use XInclude with Java 1.5 XML Properties?
Since JDK 1.5 Properties can be loaded from a simple XML file (see IBM article ). 从JDK 1.5开始,可以从简单的XML文件加载属性(请参阅IBM文章 )。 Is it possible to use XInclude in one of these XML properties files to compose multiple files? 是否可以在这些XML属性文件之一中使用XInclude来组成多个文件?
As far as I know, java.util.Properties uses DOM to parse xml properties files, and DOM does support XInclude. 据我所知,java.util.Properties使用DOM来解析xml属性文件,而DOM确实支持XInclude。 But it's turned off by default. 但是默认情况下它是关闭的。 Maybe you can specify a system property to turn it on (but I don't know). 也许您可以指定一个系统属性以将其打开(但我不知道)。
Another possibility is to try with DTD inclusion: 另一种可能性是尝试包含DTD:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE properties [
<!ENTITY include1 SYSTEM "./include1.xml">
<!ENTITY include2 SYSTEM "http://foobar.com/include2.xml">
]>
<properties>
<entry key="foo">bar</entry>
<entry key="fu">baz</entry>
&include1;
&include2;
</properties>
This should work. 这应该工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.