I have a project where I created a custom namespace for Spring configuration (pretty simple, it lets you specify a site map with <node> elements). I have this working in an isolated project where I did the initial development. Basically, I have an XSD, a couple of bean classes, a namespace handler, a bean definition parser, then the spring.handlers, spring.schema, and spring.tooling files. You can see how this works in the attached sample code. Just import that project into STS and it should work.
This all works great until I try to merge this into my larger framework project. At that point, something goes wrong. The exact same code fails when I move it over there. The nature of the failure's pretty easy to understand, it's the WHY of the failure that's the problem. Basically in that project, instead of mapping the namespace to the XSD file, it goes to the URI online. I can tell because the errors contain all this stuff about CSS styles:
Note that, if you get this same behavior with the provided sample code (I don't think you will, as I've tried this on multiple machines; projects that work on one machine work on another, while the project that fails fails elsewhere as well), you'll see a different message:Code:Description Resource Path Location Type Referenced file contains errors (http://www.rick.org/schema/rix/rix.xsd). For more information, right click on the message in the Problems View and select "Show Details..." TestSiteMap-context.xml /TIP/src/test/java/org/rick/framework/sitemap line 1 XML Problem s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw ';}'. TestSiteMap-context.xml /TIP/src/test/java/org/rick/framework/sitemap line 71 Spring Beans Problem s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw '.adblock {padding-top: 5px; padding-left:10px; padding-bottom:5px;}'. TestSiteMap-context.xml /TIP/src/test/java/org/rick/framework/sitemap line 34 Spring Beans Problem s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw '.blackbullet{margin-bottom: 3px; margin-left: 7px; margin-right: 7px;}'. TestSiteMap-context.xml /TIP/src/test/java/org/rick/framework/sitemap line 28 Spring Beans Problem s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw '.clear { clear:both;}'. TestSiteMap-context.xml /TIP/src/test/java/org/rick/framework/sitemap line 26 Spring Beans Problem s4s-elt-character: Non-whitespace characters are not allowed in schema elements other than 'xs:appinfo' and 'xs:documentation'. Saw '.footerlink1{font-size: 11px; color: #1637AA;}'. TestSiteMap-context.xml /TIP/src/test/java/org/rick/framework/sitemap line 29 Spring Beans Problem
I've used a different URL in the sample I've provided just to change the company name in the code. But the point is that it's going out and trying to download the XSD instead of resolving it to the XSD file specified in the spring.schemas.Code:Open quote is expected for attribute "align" associated with an element type "div". TestSiteMap-context.xml
What's frustrating about this is that it WORKS in some cases and fails in the other, all with the same code and in the same workspace (so it's not a workspace setting, and no entering the namespace URI into the XML catalog doesn't fix the issue). I've done a file-by-file compare and can't see any project settings that are appreciably different that should cause this behavior.
The final test is that I can do a Maven build of the project that's failing in STS and it builds successfully! So there's nothing in the code itself. This has to be an STS issue, but I can't for the life of me figure out what's going on. Any help would be greatly appreciated.


Reply With Quote