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