Cvc-elt.1: Unable to find the web application element declaration,

When I created a new dynamic web project in Eclipse, the automatically created one web.xmlshowed the following error:

cvc-elt.1: Unable to find web application element declaration

and the red background in this line:

<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

I want to know why this error occurs and how to get rid of this error. I used Eclipse version 3.1, Apache Tomcat 5.0 and JDK 1.4 in my project. I am new to Eclipse.

+5
source share
4 answers

You need to add an element DOCTYPEto the beginning of the XML:

<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
+3
source

Eclipse 4.1, Apache Tomcat 7.x JDK 1.6. , XSD. web.xml, DTD . , . , , XSD .

: XSD Eclipse XML . , Java XSD - , -, , Eclipse, XSD. , Oracle/Sun , , Eclipse . , .

. Sun , XSD - . Eclipse, XML XSD. , Eclipse . , Sun --- , -, .

+2

. . . . .

+1

, -, , xsd .

0

All Articles