Back Forum Reply New

DTD validation during initialization

Hi,

When Spring starts up, I assumed it needed access to the network in order to validate the DTDs when parsing beans.  However, when I ran my unit tests locally with my machine unplugged from the network I found that Spring initialized my beans and the tests ran fine.

So I'm wondering:

1) Does Spring attempt to load the DTDs referenced in the config files (e.g. dtd/spring-beans.dtd) but turn off validation if they're not available?

2) Which class controls this behavior?  XmlBeanDefinitionReader?  Is it possible to set a custom EntityResolver to control this behavior more explicitly?

thanks,

-- James

I think the XmlBeanDefinitionReader loads the dtd from spring.jar.

ah, yes, I see it in there now.

thanks!

Indeed it does - however, if you really want to use the DTD from over the wire you should look into your XML parser documentation - you can manually set the location to be used when looking for a DTD.
¥
Back Forum Reply New