Thursday, March 1, 2012

Spring-Beans.DTD / Spring-Webflow.DTD - XML validation Issue and Solution




This is the issue: The file cannot be validated as the XML Schema "http://www.springframework.org/dtd/spring-beans-2.0.dtd" that is specified as describing the syntax of the file cannot be located.

Solution: Use “XML Catalog”

Step 1 : Add XML Catalog in Eclipse: XML à XML Catalog à User Specified Entries à New
Location:             org\springframework\beans\factory\xml\spring-beans-2.0.dtd in jar file D:\work\Learn\SpringExample1\WebContent\WEB-INF\lib\org.springframework.beans-3.1.1.RELEASE.jar
URI:                        jar:file:///D:/work/Learn/SpringExample1/WebContent/WEB-INF/lib/org.springframework.beans-3.1.1.RELEASE.jar!/org/springframework/beans/factory/xml/spring-beans-2.0.dtd
Key Type:            URI
Key:                       CATALOG-spring-beans-2.0.dtd [or use the generic one ‘-//SPRING//DTD BEAN 2.0//EN’ à you can give any name, but use the same in your XML]
  

Step 2: Use this Catalog Key in your XML. No need to use the DTD path and XSD Schema etc at all. Now you have the auto complete enabled as per the TDD 

No comments:

Post a Comment