iamjerryyeung

Thursday, June 23, 2005

dtd schema find

public DTDEntityResolver() { //backward compatibility resourceLoader = this.getClass().getClassLoader(); }
/** * Set the class loader used to load resouces * * @param resourceLoader class loader to use */ public DTDEntityResolver(ClassLoader resourceLoader) { this.resourceLoader = resourceLoader; }
public InputSource resolveEntity (String publicId, String systemId) { if ( systemId!=null && systemId.startsWith(URL) ) { log.debug("trying to locate " + systemId + " in classpater org/hibernate/"); // Search for DTD String path = "org/hibernate/" + systemId.substring( URLth() ); InputStream dtdStream = resourceLoader==null ? getClass().getResourceAsStream(path) : resourceLoader.getResourceAsStream(path)
if (dtdStream==null) { log.debug(systemId + " not found in classpath"); return null; } else { log.debug("found " + systemId + " in classpath")
InputSource source = new InputSource(dtdStream); source.setPublicId(publicId); source.setSystemId(systemId); return source; }

0 Comments:

Post a Comment

<< Home