Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

eclipse on maven project warning 'DTD or XML schema'

Description Resource    Path    Location    Type
No grammar constraints (DTD or XML schema) detected for the document.   TEST-net.kindleit.gae.example.server.MessageRepositoryTest.xml  /projecttest-gae-example/target/surefire-reports    line 1  XML Problem
No grammar constraints (DTD or XML schema) detected for the document.   appengine-web.xml   /projecttest-gae-example/src/main/webapp/WEB-INF    line 1  XML Problem
No grammar constraints (DTD or XML schema) detected for the document.   appengine-web.xml   /projecttest-gae-example/target/projecttest-gae-example-1.0-SNAPSHOT/WEB-INF    line 1  XML Problem
No grammar constraints (DTD or XML schema) detected for the document.   datastore-indexes-auto.xml  /projecttest-gae-example/WEB-INF/appengine-generated    line 1  XML Problem
No grammar constraints (DTD or XML schema) detected for the document.   jdoconfig.xml   /projecttest-gae-example/src/main/resources/META-INF    line 1  XML Problem
No grammar constraints (DTD or XML schema) detected for the document.   jdoconfig.xml   /projecttest-gae-example/target/projecttest-gae-example-1.0-SNAPSHOT/WEB-INF/classes/META-INF   line 1  XML Problem
No grammar constraints (DTD or XML schema) detected for the document.   webapp-cache.xml    /projecttest-gae-example/target/war/work    line 1  XML Problem

how to fix the above problem on eclipse? my project is maven based. Is it because I miss out some dtd files? how to include it?

example jdoconfig.xml

<?xml version="1.0" encoding="utf-8"?>
<jdoconfig xmlns="http://java.sun.com/xml/ns/jdo/jdoconfig"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="http://java.sun.com/xml/ns/jdo/jdoconfig">

    <persistence-manager-factory name="transactions-optional">
        <property name="javax.jdo.PersistenceManagerFactoryClass"
            value="org.datanucleus.store.appengine.jdo.DatastoreJDOPersistenceManagerFactory"/>
        <property name="javax.jdo.option.ConnectionURL" value="appengine"/>
        <property name="javax.jdo.option.NontransactionalRead" value="true"/>
        <property name="javax.jdo.option.NontransactionalWrite" value="true"/>
        <property name="javax.jdo.option.RetainValues" value="true"/>
        <property name="datanucleus.appengine.autoCreateDatastoreTxns" value="true"/>
    </persistence-manager-factory>
</jdoconfig>
like image 657
cometta Avatar asked Dec 30 '09 16:12

cometta


People also ask

What is XML Schema and DTD?

DTD mainly checks the grammar and validity of a XML document. It checks that a XML document has a valid structure or not. 2. XML Schema Definition (XSD) : XSD stands for XML Schema Definition and it is a way to describe the structure of a XML document.

What is schema in eclipse?

Eclipse XSD™ is a library that provides an API for manipulating the components of an XML Schema as described by the W3C XML Schema specifications, as well as an API for manipulating the DOM-accessible representation of XML.


1 Answers

Initial answer (Dec. 2009)

If you have WTP (with the XML part included):

Preferences->Validation->XML Validator-> unclick manual and/or build should prevent eclipse checking the DTD

Or:

From the Preference page, choose XML > XML Files. Under the section "Validating files" you can change the severity in the drop down from Warning to Ignore. Just note that this is for all XML files, not just build.xml. But you can just add build.xml to the exclude filter if you would still like this warning for other XML files.

alt text


Update (Feb. 2012)

Someone made in the comments (now deleted) the valid point that you should Never ignore warnings.
But Fix them!

When ask how, he goes on (emphasis mine):

I'd fix Eclipse because this is clearly a sign of bad design.
For example I might report a bug to Eclipse Foundation bug tracker.
Eclipse needs to add "sane" defaults for Spring/Java EE project files that are "known" to have no need of XML grammars.
Either something is wrong with the file or Eclipse is broken somewhere.
Three problems I had:

  1. with Log4j.xml file, saying it cannot find the XML definition for log4j.dtd although the file is in the system path where the Validator looks
  2. Ant build.xml file says I have no grammar constraints
  3. for some reason I can't clean the project.

There are actually bugs discussing strategies/bugs around those warning:

  • bug 218326: ""No grammar constraints" warnings for system files in the Problems view" did take the "exclusion route"
  • bug 331749 complains about "No grammar constraints" even though directory is excluded

Obviously, more fixes are required regarding the management of those warnings.

like image 52
VonC Avatar answered Oct 05 '22 23:10

VonC