1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 package com.finalist.mmbase.wizard;
16
17 import org.xml.sax.EntityResolver;
18 import org.xml.sax.InputSource;
19
20 import java.io.FileReader;
21
22 /***
23 * The com.finalist.mmbase.wizard.MMBaseDTDResolver checks if the
24 * requested dtd is known and returns a reference.
25 *
26 * @author Kors van Beem
27 * @version $Revision: 1.3 $, $Date: 2004/10/23 08:54:39 $
28 *
29 */
30 public class MMBaseDTDResolver implements EntityResolver {
31
32 /***
33 *
34 * @param publicId The description of the dtd.
35 * @param systemId The reference to a dtd on a site.
36 * @return The correct inputsource
37 */
38 public InputSource resolveEntity (String publicId, String systemId) {
39 InputSource returnSource = null;
40 try {
41 if (systemId.equalsIgnoreCase("http://www.mmbase.org/dtd/application_1_0.dtd")) {
42 returnSource = new InputSource(this.getClass().getResourceAsStream("/dtd/application_1_0.dtd"));
43 }
44 if (systemId.equalsIgnoreCase("http://www.mmbase.org/dtd/application_1_1.dtd")) {
45 returnSource = new InputSource(this.getClass().getResourceAsStream("/dtd/application_1_1.dtd"));
46 }
47 if (systemId.equalsIgnoreCase("http://www.mmbase.org/dtd/wizard-schema_1_0.dtd")) {
48 returnSource = new InputSource(this.getClass().getResourceAsStream("/dtd/wizard-schema_1_0.dtd"));
49 }
50 }
51 catch (Exception e) {
52 e.printStackTrace();
53 }
54 return returnSource;
55 }
56 }