Accepted answer

you have two options:

  1. configure workspace settings (disable the validation for the current workspace): go to window > preferences > validation and uncheck the manual and build for: xml schema validator, xml validator

  2. check enable project specific settings (disable the validation for this project): right-click on the project, select properties > validation and uncheck the manual and build for: xml schema validator, xml validator

right-click on the project and select validate to make the errors disappear.


in jboss developer 4.0 and above (eclipse-based), this is a tad easier. just right-click on your file or folder that contains xml-based files, choose "exclude validation", then click "yes" to confirm. then right-click the same files/folder again and click on "validate", which will remove the errors with a confirmation.


ensure your encoding is correct for all of your files, this can sometimes happen if you have the encoding wrong for your file or the wrong encoding in your xml header.

so, if i have the following newfile.xml:

<?xml version="1.0" encoding="utf-16"?>
<bar foo="foiré" />

and the eclipse encoding is utf-8:

eclipse encoding resource

the encoding of your file, the defined encoding in eclipse (through properties->resource) and the declared encoding in the xml document all need to agree.

the validator is attempting to read the file, expecting <?xml ... but because the encoding is different from that expected, it's not finding it. hence the error: content is not allowed in prolog. the prolog is the bit before the <?xml declaration.

edit: sorry, didn't realise that the .xml files were generated and actually contain javascript.

when you suspend the validators, the error messages that you've generated don't go away. to get them to go away, you have to manually delete them.

  1. suspend the validators
  2. click on the 'content is not allowed in prolog' message, right click and delete. you can select multiple ones, or all of them.
  3. do a project->clean. the messages should not come back.

i think that because you've suspended the validators, eclipse doesn't realise it has to delete the old error messages which came from the validators.


window > preferences > validation > uncheck xml validator manual and build enter image description here


the other answers may work for you, but they did not cover my case. i wanted some xml to be validated, and others not. this image shows how to exclude certain folders (or files) for xml validation.

begin by right clicking the root of your eclipse project. select the last item: properties...

enter image description here

(if your browser scales this image very small, right click and open in a new window or tab.)

  • eclipse appears to be very sensitive if you click the **browse file...* or **browser folder...* button. this dialog needs some work!
  • this was done using eclipse 4.3 (kepler).

Related Query

More Query from same tag