2
votes

I have an eclipse dynamic web Project, this warning appear in all XML files;

No grammar constraints (DTD or XML Schema) referenced in the document.

enter image description here

how can i solve it ?

4
just add <!DOCTYPE ehcache> on line 2.Kir Kanos

4 Answers

-1
votes

To resolve an error whose message is "No DTD or schema referenced in document", perhaps the simplest approach would be to reference the relevant DTD or schema from the document. That involves (a) having a DTD or XSD schema for each document type you are using, (b) knowing where they are, and (c) adding the appropriate reference to the document, or supplying the relevant information elsewhere in the Eclipse configuration. Your question provides no clue as to which of these you are finding hard or confusing.

Or possibly you merely want to change some option in Eclipse to make it stop expecting that there will be a DTD or schema -- it would be surprising to me if Eclipse required that there be a schema for every bit of XML it is asked to handle, so it looks off hand as if something in your setup was asking Eclipse not just to work with the XML but to validate it.

7
votes

Try this :

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

Regards

5
votes

Right click on the project and open properties.

Then open Validation > XML Syntax.

Check "Enable project properties" (or edit workspace properties)

In front of "No grammar specified" select "Ignore"

Clean an rebuild your project, the warning should have disappeared.

2
votes

Error on line 1:No Grammer Conctraints(DTD or XML Schema)referenced in the document. I fixed it by adding:

<!DOCTYPE xml>

as the second line in XML file which means:

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

After Adding the second line Rt.click on testng.xml file if you see this only one option such as 1.XLS transformation.

Options I have when I Rt.click on testNG.xml file : 1.XLS Transformation

Then Follow these steps:

How I Resolved:

  • Rt. Click on testNG
  • Run as
  • Run Configurations
  • Click on Common tab
  • Click on Other button
  • Change encoding to Cp-1252
  • Click on Run