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 wicketstuff-jing Show documentation
Show all versions of wicketstuff-jing Show documentation
Jing is a validator for RELAX NG and other schema languages. This
project was taken from http://code.google.com/p/jing-trang and
mavenized for inclusion in the Wicket Stuff HTML Validator.
The code was taken from the 20091111 release.
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();
}
}