throws XNIException, IOException {
// resolve entity using DOM entity resolver
if (fEntityResolver != null) {
try {
DOMInputSource inputSource =
resourceIdentifier == null ?
fEntityResolver.resolveEntity(null, null, null) :
fEntityResolver.resolveEntity(resourceIdentifier.getPublicId(), resourceIdentifier.getLiteralSystemId(), resourceIdentifier.getBaseSystemId());
if (inputSource != null) {
String publicId = inputSource.getPublicId();
String systemId = inputSource.getSystemId();
String baseSystemId = inputSource.getBaseURI();
InputStream byteStream = inputSource.getByteStream();
Reader charStream = inputSource.getCharacterStream();
String encoding = inputSource.getEncoding();
XMLInputSource xmlInputSource =
new XMLInputSource(publicId, systemId, baseSystemId);
xmlInputSource.setByteStream((InputStream)byteStream);
xmlInputSource.setCharacterStream(charStream);
xmlInputSource.setEncoding(encoding);