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

cmcginty picture cmcginty · Jan 28, 2011 · Viewed 98.4k times · Source

Eclipse 3.5.2 is throwing an XML schema warning message:

No grammar constraints (DTD or XML schema) detected for the document.

The application.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<application
  xmlns="http://java.sun.com/xml/ns/javaee"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
                      http://java.sun.com/xml/ns/javaee/application_5.xsd"
  version="5">

</application>

I do not want to disable the warning. How can I get Eclipse to correctly validate the XML document?

Answer

Plenus Franckly picture Plenus Franckly · Jul 30, 2013

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

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