Community
Participate
Working Groups
Steps to reproduce: 1. Open the Java EE perspective. 2. Create a Web project (or EJB project, or else). 3. Look at the Problems view. There are warnings stating: No grammar constraints (DTD or XML schema) detected for the document. While, in general, this warnings are a good thing, they should not be fired for system XML files like: .project, .classpath, files in .settings, etc. Messages (warnings and errors) in the Problems view are for the user and it is expected some action by him/her to resolve them. In this particular case the user cannot take any adequate action and these warnings are frustrating for him/her.
Created attachment 89260 [details] screenshot See the attachment to see how this looks to the user. The Problem view is actually flooded with such warnings.
Gary, I'm just speculating here but the XML validator has recently been ported to the new validation framework. At the same time the option to report a missing grammar has been swiched to true by default. So perhaps this combination of changes is producing these warnings. I think the new validation framework will have to avoid passing these system files to the XML validator.
(In reply to comment #2) I think the framework is currently working "as designed". There is no such thing as a "system" file. (In looking through the documentation on IResource there are derived files, hidden files and team private files, but no concept of a system file). Since these files all have a content type of XML, and since the XML validator is asking to validate all files with an XML content type, the framework is passing the validator the correct files. I wonder if the proper fix would be to add .project, .classpath and .settings to an exclusion rule for the XML validator. What do you think? This would require an enhancement to the framework, to be able to specify unqualified file names. (Right now you could specify "MyProject/.project" but there is no way to just specify ".project")
Gary, I am not arguing about the functional correctness of the validation framework. It's all about usability and the user's perspective. Yes, the idea of exclusion rule is a possible solution. Another one, and may be better from design point of view, is to provide DTD or XML schemas for all XML-based "system" files. But I am not sure who would be responsible for this and whether it could be achieved in the Ganymede timeframe.
Created attachment 89393 [details] patch to add some exclusion rules If we go the exclusion rule route, here is a patch that will stop the warnings (and the validation) for common "system" files that are created in a dynamic web application.
(In reply to comment #4) > Gary, I am not arguing about the functional correctness of the validation > framework. It's all about usability and the user's perspective. Sorry I didn't mean to sound defensive. I agree with you that this is a usability problem that needs to be fixed.
(In reply to comment #3) > > I wonder if the proper fix would be to add .project, .classpath and .settings > to an exclusion rule for the XML validator. What do you think? This would > require an enhancement to the framework, to be able to specify unqualified file > names. (Right now you could specify "MyProject/.project" but there is no way to > just specify ".project") > I was wrong about this. The framework does support this now (as shown by the patch that I just submitted). By "supports this now", I mean that it currently supports project relative file and folder names.
In looking at the XML validator's plugin.xml I see: <projectNature id="org.eclipse.jst.j2ee.ejb.EJBNature"/> <projectNature id="org.eclipse.jst.j2ee.EARNature"/> Are these natures right? I didn't see the EAR one, when I created a new ear project.
(In reply to comment #8) > In looking at the XML validator's plugin.xml I see: > > <projectNature id="org.eclipse.jst.j2ee.ejb.EJBNature"/> > <projectNature id="org.eclipse.jst.j2ee.EARNature"/> > > Are these natures right? I didn't see the EAR one, when I created a new ear > project. > Hmm, as far as I know Java EE projects are based on facets - not on natures. May be these <projectNature> tags are some legacy. I add Chuck and Kosta in CC to comment on this.
(In reply to comment #5) > Created an attachment (id=89393) [details] > patch to add some exclusion rules > > If we go the exclusion rule route, here is a patch that will stop the warnings > (and the validation) for common "system" files that are created in a dynamic > web application. > I've tried the patch. It does a good job. All "extra" warnings have disappeared. Just to remark: this patch applies the exclusion rule to all kinds of project - not only dynamic web project. This is correct!
Regarding the natures, that looks like some old code dating back to WTP 0.7 days that should be updated. All WTP projects use facets rather than natures.
David, I'd like to request approval to commit and release this fix for M5.
While I don't agree with the implied severity of this bug causing us to respin, it does appear to be a safe workaround regardless. A better fix would be to tell the framework to ignore a set of resources outright, not just per validator.
All XML core and XML validation unit tests are green. Fix committed and released for WTP 3.0 M5 builds > v200802151147. I tend to agree with Nitin that for the long term the fix should go in the framework, perhaps by providing a customizable set of resources to ignore for all validators.
Verified with the official Ganymede release.