KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > thaiopensource > relaxng > parse > sax > DtdContext


1 package com.thaiopensource.relaxng.parse.sax;
2
3 import org.xml.sax.DTDHandler JavaDoc;
4 import org.xml.sax.SAXException JavaDoc;
5 import org.relaxng.datatype.ValidationContext;
6
7 import java.util.Hashtable JavaDoc;
8
9 public abstract class DtdContext implements DTDHandler JavaDoc, ValidationContext {
10   private final Hashtable JavaDoc notationTable;
11   private final Hashtable JavaDoc unparsedEntityTable;
12
13   public DtdContext() {
14     notationTable = new Hashtable JavaDoc();
15     unparsedEntityTable = new Hashtable JavaDoc();
16   }
17
18   public DtdContext(DtdContext dc) {
19     notationTable = dc.notationTable;
20     unparsedEntityTable = dc.unparsedEntityTable;
21   }
22
23   public void notationDecl(String JavaDoc name,
24                            String JavaDoc publicId,
25                            String JavaDoc systemId)
26           throws SAXException JavaDoc {
27     notationTable.put(name, name);
28   }
29
30   public void unparsedEntityDecl(String JavaDoc name,
31                                  String JavaDoc publicId,
32                                  String JavaDoc systemId,
33                                  String JavaDoc notationName)
34           throws SAXException JavaDoc {
35     unparsedEntityTable.put(name, name);
36   }
37
38   public boolean isNotation(String JavaDoc notationName) {
39     return notationTable.get(notationName) != null;
40   }
41
42   public boolean isUnparsedEntity(String JavaDoc entityName) {
43     return unparsedEntityTable.get(entityName) != null;
44   }
45
46   public void clearDtdContext() {
47     notationTable.clear();
48     unparsedEntityTable.clear();
49   }
50 }
51
Popular Tags