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

Post Top Ad

Responsive Ads Here

Post Top Ad

Responsive Ads Here

Tuesday, January 9, 2007

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.

6 comments:

  1. thanks a lot!! this is simple, but sometimes little deitals make us lose time

    ReplyDelete
  2. Thanks this is really useful. I tried a lot to solve this myself.

    ReplyDelete
  3. I had all these set. My error was coming from not specifying endorsed directory. Thanks anyways :)

    ReplyDelete
  4. 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

    ReplyDelete
  5. Well, it is a late response to Rajan D, but could come useful for others. It is definitely due to what you described.
    PJ

    ReplyDelete

Post Top Ad

Responsive Ads Here