I have an application context defined using XML config files with the Spring 2.5 XSD, and would like to use XML entities to provide an extension point for customizing a client's installation.
I started with an XML config file defined in the customary fashion:
Now, I would like to define some entities that will be resolved using a filesystem resource. A couple of Google searches suggest adding the following inline DTD snippet:
<!-- Define beans here... -->
The problem I'm running into is that the Spring 2.5 XSD referenced in my document root seems to be disregarded in favor of the more restrictive DTD, and the SAX parser no longer accepts my config file as valid XML. I get exceptions such as:
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "springframework.org/dtd/spring-beans-2.0.dtd"
<!ENTITY % entities SYSTEM "my/path/entities.ent" >
org.xml.sax.SAXParseException: Attribute "xmlns" must be declared for element type "beans".
I need the more flexible XSD-based validation because I'm using elements from the Spring Security namespace that are not allowed by the simple DTD. Any suggestions on how to get DTD-based XML entity declarations to co-exist with the Spring 2.5 XSD?