All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.thaiopensource.relaxng.parse.sax.DtdContext Maven / Gradle / Ivy

Go to download

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.

There is a newer version: 1.11
Show 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();
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy