简体   繁体   English

我可以将XInclude与Java 1.5 XML属性一起使用吗?

[英]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.

相关问题 尝试在Java中使用XInclude并使用xml:id解决该片段 - Trying to use XInclude with Java and resolving the fragment with xml:id 我们如何在 Liquibase XML 更改日志中使用 xinclude? - How can we use xinclude in Liquibase XML changlelog? Java 1.5枚举:为什么不能对1.5枚举使用&#39;findBy&#39;? - Java 1.5 Enum: Why can't I use 'findBy' with 1.5 enums? X从依赖java模块的资源中包含xml文件 - XInclude xml file from resources of dependent java module 我应该在Java 1.5中使用哪个XPathAPI? - Which XPathAPI should I use in Java 1.5? 我可以在 java 8 中使用接口来继承属性吗? - Can I use interfaces for inheritance of properties in java 8? 我可以在 JAVA 的属性文件中使用正则表达式吗? - Can I use regex in properties file in JAVA? 是否可以在 XInclude 属性 href 中使用 Java 系统属性变量? - Is it possible to use Java system property variable in XInclude attribute href? Java 6 中对 xinclude 的默认支持? - Default support for xinclude in Java 6? 是什么导致 Eclipse 中导入的 Maven 项目默认使用 Java 1.5 而不是 Java 1.6,我如何确保它不会? - What causes imported Maven project in Eclipse to use Java 1.5 instead of Java 1.6 by default and how can I ensure it doesn't?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM