How to fix Eclipse validation error "No grammar constraints detected for the document"?

Putting this at the top of any offending file works for me:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE project>

Not sure if you ever resolved this satisfactorily but I ran across this posting today while working with some Spring configuration files in Eclipse 3.6. I could not get the error to go away in the Problems view in Eclipse no matter what, until I right-clicked on the problem and deleted it.

I figured it would come back if I revalidated and there was actually a problem and so far it hasn't. The thing is I had an almost identical Spring config file that wasn't showing the error.

It would seem that sometimes stuff just gets stuck in Eclipse. Not sure why but between this and files getting out of sync with the editors and having to force a refresh I guess I have to accept it.


This is another way to turn off warnings for XML Documents that intentionally lack a DTP or XSD:

  1. Go to Menu Preferences,
  2. in the navig menu, i.e. the Left frame of the dialog-box, Choose: XML > XML Files > Validation
  3. in the config area, i.e the right frame of the dialog-box, choose: Validating Files > No grammar specified > Ignore (This is a select box) default setting is warning)