Code example for InputSource

Methods: setByteStream, setPublicId

0
    if (resolved == null && piCatalogResolver != null) {
      resolved = piCatalogResolver.getResolvedEntity(publicId, systemId);
    } 
 
    if (resolved != null) {
      try { 
	InputSource iSource = new InputSource(resolved);
	iSource.setPublicId(publicId);
 
	// Ideally this method would not attempt to open the 
	// InputStream, but there is a bug (in Xerces, at least) 
	// that causes the parser to mistakenly open the wrong 
	// system identifier if the returned InputSource does 
	// not have a byteStream. 
	// 
	// It could be argued that we still shouldn't do this here, 
	// but since the purpose of calling the entityResolver is 
	// almost certainly to open the input stream, it seems to 
	// do little harm. 
	// 
	URL url = new URL(resolved);
	InputStream iStream = url.openStream();
	iSource.setByteStream(iStream);
 
	return iSource;
      } catch (Exception e) {
	catalogManager.debug.message(1,