Can I use XInclude with Java 1.5 XML Properties?
Since JDK 1.5 Properties can be loaded from 开发者_StackOverflowa simple XML file (see IBM article). Is it possible to use XInclude in one of these XML properties files to compose multiple files?
As far as I know, java.util.Properties uses DOM to parse xml properties files, and DOM does support 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:
<?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.
精彩评论