[jboss-dev-forums] [Design of JBossXB] - JBossEntityResolver and predefined locations

adrian@jboss.org do-not-reply at jboss.com
Thu Oct 5 07:29:35 EDT 2006


The JBossEntityResolver only looks in the classpath for predetermined filenames.

I've added some code that treats the file as a system id, i.e. a URI
when it is not found in the classpath.


  |          InputStream ins = loadClasspathResource(filename, trace);
  |          if( ins != null )
  |          {
  |             inputSource = new InputSource(ins);
  |             inputSource.setPublicId(publicId);
  |          }
  |          else
  |          {
  | -            log.warn("Cannot load publicId from resource: " + filename);
  | +            log.trace("Cannot load publicId from classpath resource: " + filename);
  |             
  | +            // Try the file name as a URI
  | +            inputSource = resolveSystemIDasURL(filename, trace);
  |             
  | +            if (inputSource == null)
  | +               log.warn("Cannot load publicId from resource: " + filename);
  |          }
  | 

This is useful for testing where I can easily determine the URL
using classloader.getResource() but it more difficult to determine the
classpath location.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3976280#3976280

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3976280



More information about the jboss-dev-forums mailing list