This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes pom.xml is not valid because  cvc-elt.1: Cannot find the declaration of element 'project'. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "pom.xml is not valid because  cvc-elt.1: Cannot find the declaration of element Watch "pom.xml is not valid because  cvc-elt.1: Cannot find the declaration of element New topic
Author

pom.xml is not valid because cvc-elt.1: Cannot find the declaration of element 'project'.

Aji Sree
Greenhorn

Joined: Jun 19, 2009
Posts: 18
Hi,

I am getting this error when validating an xml file with an xsd.

pom.xml is not valid because cvc-elt.1: Cannot find the declaration of element 'project'.

The xml file actually contains the 'project' tag. I am wondering still why this error happens!!!.

Actually I am programmatically validates a supplied xml with the schema.
ie


This xml itself contains reference to a schema 'maven-v4_0_0.xsd'.

See the start tag of the xml
<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/maven-v4_0_0.xsd">

Is it like that if my xml file contains reference to another schema, the programmatic comparison with the supplied schema will not take place?
Please note that I should not delete the schema which is refernced in the xml file.

Please give me a solution for this..

thank you
Ajith
g tsuji
Ranch Hand

Joined: Jan 18, 2011
Posts: 499
    
    3
>Is it like that if my xml file contains reference to another schema, the programmatic comparison with the supplied schema will not take place?
Not so. The supplied schema will always prevail. If it isn't "supplied" in the program, it will try to load what is specified. The operation might be successful following with the validation to proceed as usual, or fail leading to a File to read schema document SAXParseException...
 
Consider Paul's rocket mass heater.
 
subject: pom.xml is not valid because cvc-elt.1: Cannot find the declaration of element 'project'.
 
Similar Threads
Spring Application Context in Maven multi-module project
XSD validation in XML
maven java:compile
how to make the plugin jar to take the specified version from the pom.
Maven - Unresolved references to [javax.activation, javax.annotation]