Java News Tips Software
Java News Tips Software | Contact | Facebook | Twitter RSS

Eclipse - cvc-elt.1: Cannot find the declaration of element error

When working with XML files in Eclipse, a common error developers encounter is;
cvc-elt.1: Cannot find the declaration of element "some-element-name".


The error message gives a clue on which file the error exists by pointing to the element name, but does not give any information on why this error is shown or how it could be fixed. Given error is generated if parser could not find any specification on the given elements when Eclipse tries to parse the XML file using Xerces XML parser. To over come the error, XML file must be provided with a specification (a schema file or a DTD file).

Examples of such files may look like below.
<!DOCTYPE mule-configuration PUBLIC "-//Comp //DTD configuration XML V1.0//EN" 
"http://www.comp.com/dtds/proj/project-configuration.dtd">

or

<element 
xmlns="http://www.comp.com/schema/element"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.comp.com/schema/element
http://www.comp.com/schema/element/elements-1.0.xsd">

Hope this tip would help you.

Labels:


6 Comments

  1. thanks a lot!! this is simple, but sometimes little deitals make us lose time
  2. Thanks this is really useful. I tried a lot to solve this myself.
  3. Anonymous Anonymous on May 19, 2009 8:45 PM  
    I had all these set. My error was coming from not specifying endorsed directory. Thanks anyways :)
  4. Anonymous Anonymous on July 18, 2009 1:04 AM  
    Hello, We have mutlitple users of our software spread across US. Only one user is getting the following error when submitting an XML file during parsing. The DTD/SCHEMA is stored in a remote server. All other users are ok. Is this error generated because the Firewall at the user's end is not opened to communicate with out server which has the DTD/SCHEMA. The XML file has the path to the DTD/Schema file.

    CVC-ELT.1:CANNOT FIND THE DECLARATION OF ELEMENT 'ORDER_ENTRY'.

    Rajan D
  5. Anonymous Anonymous on January 15, 2011 9:36 PM  
    Well, it is a late response to Rajan D, but could come useful for others. It is definitely due to what you described.
    PJ
  6. Thanks, man!
ABOUT AUTHOR
Page Views :
Email :
PREVIOUS ARTICLES
Select Month:
TOP
Free counter and web stats