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.

Check out this stream