1 package com.thaiopensource.relaxng.jarv; 2 3 import com.thaiopensource.relaxng.impl.Pattern; 4 import com.thaiopensource.relaxng.impl.ValidatorPatternBuilder; 5 import com.thaiopensource.xml.sax.CountingErrorHandler; 6 import org.iso_relax.verifier.VerifierConfigurationException; 7 import org.iso_relax.verifier.VerifierHandler; 8 import org.xml.sax.ErrorHandler ; 9 import org.xml.sax.SAXException ; 10 11 class VerifierImpl extends org.iso_relax.verifier.impl.VerifierImpl { 12 private final VerifierHandlerImpl vhi; 13 private boolean needReset = false; 14 15 VerifierImpl(Pattern start, ValidatorPatternBuilder builder) throws VerifierConfigurationException { 16 vhi = new VerifierHandlerImpl(start, builder, 17 new CountingErrorHandler(errorHandler)); 18 reader.setDTDHandler(vhi); 19 } 20 21 public VerifierHandler getVerifierHandler() throws SAXException { 22 if (needReset) 23 vhi.reset(); 24 else 25 needReset = true; 26 return vhi; 27 } 28 29 public void setErrorHandler(ErrorHandler handler) { 30 vhi.setErrorHandler(handler); 31 super.setErrorHandler(handler); 32 } 33 34 } 35 | Popular Tags |