1 5 6 package com.hp.hpl.jena.rdf.arp; 7 8 import com.hp.hpl.jena.rdf.model.RDFErrorHandler; 9 import org.xml.sax.SAXParseException ; 10 import org.xml.sax.SAXException ; 11 18 public class ARPSaxErrorHandler extends Object implements org.xml.sax.ErrorHandler { 19 protected RDFErrorHandler errorHandler; 20 21 public ARPSaxErrorHandler(RDFErrorHandler errorHandler) { 22 this.errorHandler = errorHandler; 23 } 24 25 public void error(SAXParseException e) throws SAXException { 26 ParseException pe = null; 27 if ( e instanceof ParseException ) { 28 pe = (ParseException)e; 29 pe.promoteMe = false; 30 } 31 errorHandler.error(e); 32 if ( pe!=null &&pe.promoteMe ) { 33 pe.promoteMe = false; 34 throw pe; 35 } 36 } 37 38 public void warning(SAXParseException e) throws SAXException { 39 ParseException pe = null; 40 if ( e instanceof ParseException ) { 41 pe = (ParseException)e; 42 pe.promoteMe = false; 43 } 44 errorHandler.warning(e); 45 if ( pe!=null &&pe.promoteMe ) { 46 pe.promoteMe = false; 47 throw pe; 48 } 49 } 50 51 public void fatalError(SAXParseException e) throws SAXException { 52 ParseException pe = null; 53 if ( e instanceof ParseException ) { 54 pe = (ParseException)e; 55 pe.promoteMe = false; 56 } 57 errorHandler.fatalError(e); 58 if ( pe!=null &&pe.promoteMe ) { 59 pe.promoteMe = false; 60 throw pe; 61 } 62 } 63 64 67 void setErrorHandler(RDFErrorHandler errorHandler) { 68 this.errorHandler = errorHandler; 69 } 70 71 } 72 | Popular Tags |