You can use XML file associations with DTD.
When an XML file is associated with a DTD, it is bound by any structural rules contained in the DTD. To be considered a valid XML file, a document must be accompanied by a DTD, and conform to all of the declarations in the DTD.
You can use XML schema instead of DTD to make an association with XML document but no XML schema provided.
There are two different ways to associate XML files with DTDs or XML
schemas.
- Direct association - The XML file contains either the name of a
DTD in its doctype declaration (for example, , where dtdfile.dtd is the name of the DTD file)
or it contains the path of an XML schema in the schemaLocation
attribute of the XML file root element (for example,
, where schema.xsd
is the name of the XML schema.
- XML Catalog entry - You can
register DTD and XML schema files in the XML Catalog and associate
them with a Key that represents them. You can then refer to a DTD or
XML schema file Key from an XML file instead of referring directly to
the DTD or XML schema file. An XML Catalog entry contains two parts -
the Key (which represents the DTD or XML schema) and a URI (which
contains information about the DTD or XML schema location).
Editing the XML Catalog Settings
The XML Catalog can be accessed via the Eclipse preferences:
- Select Window -> Preferences to launch the Preferences dialog.
- In the navigation tree expand the Web and XML group and select XML Catalog.
The picture below shows how to change settings

References: