// Xerces tends to try to resolve locations with no information.
// No need to do any processing if we have no information.
if(publicId != null || systemId != null)
{
IURIResolutionResult result = uriResolver.resolve("", publicId, systemId);
String uri = result.getPhysicalLocation();
if (uri != null && !uri.equals(""))
{
// If the namespace was used to resolve this reference ensure a schema
// has been returned. Namespaces tend to point to Web resources that
// may or may not be schemas.
boolean createEntityResult = true;
if(nsUsed)
{
XSDValidator xsdVal = new XSDValidator();
xsdVal.validate(uri, uriResolver, null);
if(!xsdVal.isValid())
createEntityResult = false;
}
if(createEntityResult)
{
try
{
URL entityURL = new URL(uri);
XMLInputSource is = new XMLInputSource(rid.getPublicId(), systemId, result.getLogicalLocation());
is.setByteStream(entityURL.openStream());
if (is != null)
{
return is;
}