I have this dtd : http://fast-code.sourceforge.net/template.dtd But when I include in an xml I get the warning : No grammar constraints (DTD or XML schema) detected for the
What I found to be the solution was something very very simple that I think you should try before tinkering with the preferences. In my case I had this problem in a strings file that had as a base tag "resources" ...all I did was delete the tag from the top and the bottom, clean the project, save the file and reinsert the tag. The problem has since disappeared and never gave me any warnings. It may sound to simple to be true but hey, sometimes it's the simplest things that solve the problems. Cheers
Try understanding the suggestion given in warning messages, it's helps sometime.
I also had the same issues, after doing some research i found the solution and fixed by adding the below line at the beginning
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xml>
which lead to some other issue in my case. Which i solved by reading the suggestions, which again turned into the another problem, which has been solved understanding the original cause, that the first link was broken (not found). Below are the step by step images which explains what has been done to resolve the issue completely.
I deleted the warning in the problems view. It didn't come back till now.
A new clean way might be to write your xml like so:
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE rootElement>
<rootElement>
....
</rootElement>
The above works in Eclipse Juno+
Answer:
Comments on each piece of your DTD below. Refer to official spec for more info.
<!
DOCTYPE ----------------------------------------- correct
templates --------------------------------------- correct Name matches root element.
PUBLIC ------------------------------------------ correct Accessing external subset via URL.
"//UNKNOWN/" ------------------------------------ invalid? Seems useless, wrong, out-of-place.
Safely replaceable by DTD URL in next line.
"http://fast-code.sourceforge.net/template.dtd" - invalid URL is currently broken.
>
Simple Explanation:
An extremely basic DTD will look like the second line here:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE nameOfYourRootElement>
<nameOfYourRootElement>
</nameOfYourRootElement>
Detailed Explanation:
DTDs serve to establish agreed upon data formats and validate the receipt of such data. They define the structure of an XML document, including:
E.g.
<!DOCTYPE nameOfYourRootElement
[
<!ELEMENT nameOfYourRootElement (nameOfChildElement1,nameOfChildElement2)>
<!ELEMENT nameOfChildElement1 (#PCDATA)>
<!ELEMENT nameOfChildElement2 (#PCDATA)>
<!ENTITY nbsp " ">
<!ENTITY author "Your Author Name">
]>
Meaning of above lines...
Line 1) Root element defined as "nameOfYourRootElement"
Line 2) Start of element definitions
Line 3) Root element children defined as "nameOfYourRootElement1" and "nameOfYourRootElement2"
Line 4) Child element, which is defined as data type #PCDATA
Line 5) Child element, which is defined as data type #PCDATA
Line 6) Expand instances of
to  
when document is parsed by XML parser
Line 7) Expand instances of &author;
to Your Author Name
when document is parsed by XML parser
Line 8) End of definitions
This may be due to turning off validation in eclipse.