It is usefull to validate XML sources to ensure documents are well-formed and apt to further processing. In Eclipse this function can be selected in the contextual menu that displays on doing a right-click anywhere in the editor.

Note, if Notepad++ is used, the XML tools must be first installed using the Plugin manager in the Addons menu

The validation process also can be customized in the preferences of the Eclipse environment. In particular the severity of a number of errors can be adjusted to meet specific situations.

Docbook XML sources are validated against a docbookx.dtd file, whose location is indicated in the DOCTYPE element right after the xml header of the source.

In the below example the docbookx.dtd file is searched on the OASIS web site, which requires an internet connection.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" 
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"
>	
				
				

Alternatively when no internet connection is available a local copy of the DTD file can be pointed to in a DOCTYPE element like the below one. A local copy of the DTD will speed up the validation.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE book PUBLIC "docbookx" "file:///D:/Java/docbook45/docbookx.dtd">
				
				

Or even easier

<?xml version="1.0" encoding="UTF-8"?>		
<!DOCTYPE book SYSTEM "file:///D:/Java/docbook45/docbookx.dtd">
				
				

The DOCTYPE element can take a number of forms. XML catalogs are another way to let Eclipse locate a DTD file. See the Docbook documentation for more information.