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
i know this is old but I'm passing trought the same problem and found the solution in the spring documentation, the following xml configuration has been solved the problem for me.
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
http://www.springframework.org/schema/tx
<!-- THIS IS THE LINE THAT SOLVE MY PROBLEM -->
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
before I put the line above as sugested in this forum topic , I have the same warning message, and placing this...
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xml>
and it give me the following warning message...
The content of element type "template" must match "
(description,variation?,variation-field?,allow- multiple-variation?,class-
pattern?,getter-setter?,allowed-file-extensions?,number-required-
classes?,template-body)".
so just try to use the sugested lines of my xml configuration.
This worked for me in Eclipse 3.7.1: Go to the Preferences window, then XML -> XML Files -> Validation. Then in the Validating files section of the preferences panel on the right, choose Ignore in the drop down box for the "No grammar specified" preference. You may need to close the file and then reopen it to make the warning go away.
(I know this question is old but it was the first one I found when searching on the warning, so I'm posting the answer here for other searchers.)
Have you tried to add a schema to xml catalog?
in eclipse to avoid the "no grammar constraints (dtd or xml schema) detected for the document." i use to add an xsd schema file to the xml catalog under
"Window \ preferences \ xml \ xml catalog \ User specified entries".
Click "Add" button on the right.
Example:
<?xml version="1.0" encoding="UTF-8"?>
<HolidayRequest xmlns="http://mycompany.com/hr/schemas">
<Holiday>
<StartDate>2006-07-03</StartDate>
<EndDate>2006-07-07</EndDate>
</Holiday>
<Employee>
<Number>42</Number>
<FirstName>Arjen</FirstName>
<LastName>Poutsma</LastName>
</Employee>
</HolidayRequest>
From this xml i have generated and saved an xsd under: /home/my_user/xsd/my_xsd.xsd
As Location: /home/my_user/xsd/my_xsd.xsd
As key type: Namespace name
As key: http://mycompany.com/hr/schemas
Close and reopen the xml file and do some changes to violate the schema, you should be notified
I can't really say why you get the "No grammar constraints..." warning, but I can provoke it in Eclipse by completely removing the DOCTYPE declaration. When I put the declaration back and validate again, I get this error message:
The content of element type "template" must match "(description+,variation?,variation-field?,allow-multiple-variation?,class-pattern?,getter-setter?,allowed-file-extensions?,template-body+).
And that is correct, I believe (the "number-required-classes" element is not allowed).
Solved this issue in Eclipse 3.5.2. Two completely identical layouts of which one had the warning. Closed down all tabs and when reopening the warning had disappeared.
The Real Solution:
add <!DOCTYPE something>
to the begining of each problematic XML,
after the xml tag <?xml version="1.0" encoding="utf-8"?>
you can write anything for doctype, but basically it's supposed to be manifest, activity, etc. from what I understand