• Register
0 votes
148 views

Problem :

Currently I am trying to learn the Apache Maven. I have tried to write below code in Eclipse but it is giving below error to me:

Error Message:

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

My Code :
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>
<groupId>br.gov.mdic</groupId>
<artifactId>Offset</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<build>
<plugins>
    <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.0</version>
        <configuration>
            <source>1.8</source>
            <target>1.8</target>
        </configuration>
    </plugin>
</plugins>
 
8 4 2
2,300 points

1 Answer

0 votes

Solution :

I have faced this error earlier and I fixed it using below procedure

In your eclipse IDE to avoid the below message

 "No grammar constraints (dtd or xml schema) detected for the document."

I added the xsd schema file to a xml catalog under below path

"Go to Window \ preferences \ xml \ xml catalog \ User specified entries".

Then you need to click on "Add" button on your right.

<?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 above xml I had generated and then saved the xsd under below location: /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

After doing above steps you can close and then reopen the xml file and do some changes to violate the schema, you should be notified

5 2 1
4,980 points

Related questions

0 votes
1 answer 136 views
136 views
Problem : I want to run the Eclipse JSF project on the Apache Tomcat on some other computer. I created the WAR file. But, when I try to deploy the WAR and open my Facelet page in Firefox, I usually face only the below error message: &ldquo;This XML file does not appear ... first time when I am trying to run the JSF app without my Eclipse. How is this issue popping up and how can I fix the issue?
asked Jan 3 alecxe 7.5k points
0 votes
1 answer 108 views
108 views
Problem : My blog feed showing me following error today: This page contains the following errors: error on line 2 at column 6: XML declaration allowed only at the start of the document Below is a rendering of the page up to the first error
asked Dec 6, 2019 alecxe 7.5k points
1 vote
1 answer 62 views
62 views
Problem: I am very new to Web.xml coding. Currently I am facing serious problem because of my web.xml file. If I try to run my Apache tomcat 8 server then every time it shows me below error: Server tomcat v8.0 server at localhost failed to start. in eclipse. If I ... . This error made my life like the hell. So I am looking for the help from web.xml expert who can help me in fixing my problem.
asked May 18 Martin K 6.6k points
0 votes
1 answer 6 views
6 views
I am beginner in SOAP request and response. We are running a project where our client has provided us their WSDL file. Specially they need an attribute which accepts multiple values.
asked Sep 28 Daniel Anderson 4k points
0 votes
1 answer 7 views
7 views
I am trying to display xml data in html page applying JavaScript but some cases i am finding difficulty.
asked Sep 25 Daniel Anderson 4k points