如何在Spring XML文件中使用DOCTYPE [英] How to use DOCTYPE in Spring XML file
本文介绍了如何在Spring XML文件中使用DOCTYPE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大多数时候,我们在春季没有声明 DOCTYPE
。
但我想在XML上下文文件中声明DOCTYPE,以便可以在XML文件中使用 ENTITY
。
Most of the time we do not declare DOCTYPE
in Spring.
But I want to declare a DOCTYPE in my XML context file so that I can use ENTITY
in my xml file.
例如:
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN"
"http://www.springframework.org/dtd/spring-beans-2.0.dtd"
[<!ENTITY % crmHome SYSTEM "crm-home.dtd"> %crmHome;]
>
这会产生许多错误,例如...
This gives many errors like...
- Attribute "xmlns" must be declared for element type "beans".
- Attribute "xmlns:xsi" must be declared for element type "beans".
etc.....
实现此目标的方法是什么?
What is the way to achieve this?
推荐答案
这对我有用。使用Spring Framework V.4.2.1
This works for me. Using Spring Framework V.4.2.1
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">
这篇关于如何在Spring XML文件中使用DOCTYPE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文