• Register
0 votes
369 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

Please log in or register to answer this question.

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 281 views
281 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, 2020 alecxe 7.5k points
0 votes
1 answer 4 views
4 views
Problem: I have the wsdl file and the xsd file in the same folder. When I try to reference the wsdl file below, I get the error from Visual Studio: The root element of a W3C XML Schema should be <schema>
asked Mar 20 ummesalma 25.2k points
0 votes
1 answer 4 views
4 views
Problem: Please solve it &hellip; Because I am unable to find out the solution... // translate point back:
asked Mar 24 Ifra 24.4k points
0 votes
1 answer 2 views
2 views
Problem: I 'm generating some xml files that needs to conform to an xsd file that was given to me. What's the best way to verify they conform?
asked Apr 7 Sana8989 8.9k points
0 votes
1 answer 8 views
8 views
Problem: xml document structures must start and end within the same entity.
asked Mar 3 charles mathews 5.5k points
0 votes
1 answer 268 views
268 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
0 votes
1 answer 3 views
3 views
Problem: Trying with parsing but in vain . Xml parsing error junk after document element.
asked Mar 23 PkGuy 13.1k points
1 vote
1 answer 135 views
135 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, 2020 Martin K 6.6k points
0 votes
1 answer 12 views
12 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, 2020 Daniel Anderson 4k points
0 votes
1 answer 5 views
5 views
Problem: I am getting an error when trying to set my view to display the ListView for the file I want to display(text file). I am pretty sure it has something to do with the XML. I just want to display the information from this.file = fileop.ReadFileAsList("Installed_packages.txt");. Please help me to fix this. Thanks.
asked Apr 3 Shovo210 13.8k points