DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=9317>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=9317

sch-props-correct.2





------- Additional Comments From [EMAIL PROTECTED]  2002-05-24 15:40 
-------
Solved!

As long as I resolve every system ID into a fully qualified URL then I get no 
problems.
Our EntityResolver had to look for schemas as Java resources within our product 
installation. We _had_ used getResourceAsStream and were obviously losing 
some 'context'. Using class.getResource to identify a URL and creating the 
InputSource directly ( new InputSource(url.toString()) ) fixed all problems.

Then, if a resource could not be found then the systemID fell back to a default 
disc location, but we had specified this as a relative path name. Providing an 
explicit URL file location again fixed the problem.


Code looks like:
----------------------------------8<--------------------------
  public InputSource resolveEntity (String publicId, String systemId)
  {
    if( systemId==null)
    {
      // use the default behaviour
      return null;
    }

    // Try to find the systemId as a resource
    int index = 0;
    if((index = systemId.lastIndexOf("/")) >= 0)
    {
      String xsdname = systemId.substring(index);
      URL url = InternalEntityResolver.class.getResource(xsdname);
      if(url != null)
      {
        return new InputSource(url.toString());
      }
    }

    // result must have been null, fall back to default schema location
    String newURL =
      DEFAULT_FILE_LOCATION + systemId.substring(systemId.lastIndexOf("/"));
    return new InputSource(newURL);

    // use the default behaviour
    return null;

  }
-------------------------------8<---------------------------------------
Many thanx.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to