com.thaiopensource.relaxng.parse.sax.DtdContext Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of trang Show documentation
Show all versions of trang Show documentation
Jing/Trang - tools for validating and translating RelaxNG
The newest version!
package com.thaiopensource.relaxng.parse.sax;
import org.relaxng.datatype.ValidationContext;
import org.xml.sax.DTDHandler;
import org.xml.sax.SAXException;
import java.util.HashSet;
import java.util.Set;
public abstract class DtdContext implements DTDHandler, ValidationContext {
private final Set notations;
private final Set unparsedEntities;
public DtdContext() {
notations = new HashSet();
unparsedEntities = new HashSet();
}
public DtdContext(DtdContext dc) {
notations = dc.notations;
unparsedEntities = dc.unparsedEntities;
}
public void notationDecl(String name,
String publicId,
String systemId)
throws SAXException {
notations.add(name);
}
public void unparsedEntityDecl(String name,
String publicId,
String systemId,
String notationName)
throws SAXException {
unparsedEntities.add(name);
}
public boolean isNotation(String notationName) {
return notations.contains(notationName);
}
public boolean isUnparsedEntity(String entityName) {
return unparsedEntities.contains(entityName);
}
public void clearDtdContext() {
notations.clear();
unparsedEntities.clear();
}
}