Add an XSD file to Eclipse and Eliminate Those Pesky XML Warnings
If you work with Eclipse and JSF 2, you too may be annoyed at the little
that shows up next
to all your
faces-config.xml files (even those that are blessedly
Here is how you can get rid of them, and add autocompletion to faces-config
editing as well, in case they aren't empty after all. (Most of mine contain a
single element, to specify a resource bundle. Eliminating that would be a nice
item for convention-over-configuration in JSF 2.1).
- Download the source code for JSF 2 from href="http://javaserverfaces.dev.java.net">http://javaserverfaces.dev.java.net
- Make a directory such as
~/xsdand copy all files with
directory (so you can remove the source later)
- In Eclipse, locate a
faces-config.xmland copy the entry
xsi:schemaLocationattribute. You'll need it in the
clipboard for step 5.
- Select Window → Preferences →
XML → XML Catalog.
- Select Add and fill in the dialog as shown below. Pick
.xsdfile by clicking on File System and
navigating to the directory in which you saved the files. Change the
Key Type to Schema Location. Paste in the key.
- Rebuild your project. The
should be gone.
This also works for other XML schemas (such as the one for facelet tag