How to add a DTD to XML Catalog in Eclipse?

4.3k Views Asked by At

I try to add a DTD created by myself to the XML Catalog in Eclipse.
Which values do I have to enter into the fields?
Where do I have to locate the DTD in best case?

I have multiple Java projects in my Eclipse IDE. So what would be the best practice to make the DTD accessible for all projects?

I tried to use Window-->Preferences-->XML-->XML Catalog-->Add to get a catalog entry under User Specified Entries. Currently it looks like this:

Entry element:      System
Location:           cc-utils-test-db-3.1-SNAPSHOT/src/main/resources/cc_dataset.dtd
URI:                platform:/resource/cc-utils-test-db-3.1-SNAPSHOT/src/main/resources/cc_dataset.dtd
Key type:           System ID
Key:                dataset file:////services/utils/test-db/src/main/resources/cc_dataset.dtd

Referencing the DTD in the XML file, Eclipse complains:

No grammar constraints (DTD or XML Schema) referenced in the document.

and

The file cannot be validated as the XML definition "C:\develop\Projects\...\ws\services\utils\test-db\src\main\resources\globaltestdata\cc\cc_dataset.dtd (The system can't find the specified file)" that is specified as describing the syntax of the file cannot be located.

(I have partially translated from German into English.)

How do I have to make the XML Catalog entry that the DTD can be referenced (in best case over all projects in Eclipse IDE) to validate the XML file when using

<!DOCTYPE dataset SYSTEM "cc_dataset.dtd">

in it.

Where should be to DTD located (in the filesystem) to make it best accessible?

I changed my XMLC atalog entry:

Entry element:      System
Location:           cc-utils-test-db-3.1-SNAPSHOT/src/main/resources/cc_dataset.dtd
URI:                platform:/resource/cc-utils-test-db-3.1-SNAPSHOT/src/main/resources/cc_dataset.dtd
Key type:           System ID
Key:                ccdataset

The reference in the XML file:

<!DOCTYPE dataset SYSTEM "ccdataset"> 

Eclipse's reaction:

The file cannot be validated as the XML definition "C:\develop\Projects\EOBR\ws\services\utils\test-db\src\main\resources\globaltestdata\cc\ccdataset (Das System kann die angegebene Datei nicht finden)" that is specified as 
 describing the syntax of the file cannot be located.

cc_dataset.dtd is located at C:\develop\Projects\EOBR\ws\services\utils\test-db\src\main\resources\ i don't know why Eclipse extends this to the path of the XML file with the declaration.

0

There are 0 best solutions below