1 16 package org.apache.cocoon.components.validation.jaxp; 17 18 import org.apache.cocoon.components.validation.impl.ValidationResolver; 19 import org.apache.commons.lang.exception.NestableRuntimeException; 20 import org.apache.excalibur.source.SourceResolver; 21 import org.w3c.dom.DOMError ; 22 import org.w3c.dom.ls.LSException ; 23 import org.w3c.dom.ls.LSInput ; 24 import org.w3c.dom.ls.LSResourceResolver ; 25 import org.xml.sax.EntityResolver ; 26 import org.xml.sax.InputSource ; 27 28 34 public class JaxpResolver extends ValidationResolver 35 implements LSResourceResolver { 36 37 40 public JaxpResolver(SourceResolver sourceResolver, 41 EntityResolver entityResolver) { 42 super(sourceResolver, entityResolver); 43 } 44 45 61 public LSInput resolveResource(String type, String namespace, String systemId, 62 String publicId, String base) 63 throws LSException { 64 try { 65 final InputSource source = this.resolveEntity(base, publicId, systemId); 66 return new JaxpInput(source); 67 } catch (Exception exception) { 68 String message = "Exception resolving resource " + systemId; 69 Throwable err = new LSException (DOMError.SEVERITY_FATAL_ERROR, message); 70 throw new NestableRuntimeException(message, err); 71 } 72 } 73 } 74 | Popular Tags |