}
if (needExpand)
expandedSystemId = expandSystemId(literalSystemId, baseSystemId,false);
// give the entity resolver a chance
StaxXMLInputSource staxInputSource = null;
XMLInputSource xmlInputSource = null;
XMLResourceIdentifierImpl ri = null;
if (resourceIdentifier instanceof XMLResourceIdentifierImpl) {
ri = (XMLResourceIdentifierImpl)resourceIdentifier;
} else {
fResourceIdentifier.clear();
ri = fResourceIdentifier;
}
ri.setValues(publicId, literalSystemId, baseSystemId, expandedSystemId);
if(DEBUG_RESOLVER){
System.out.println("BEFORE Calling resolveEntity") ;
}
fISCreatedByResolver = false;
//either of Stax or Xerces would be null
if(fStaxEntityResolver != null){
staxInputSource = fStaxEntityResolver.resolveEntity(ri);
if(staxInputSource != null) {
fISCreatedByResolver = true;
}
}
if(fEntityResolver != null){
xmlInputSource = fEntityResolver.resolveEntity(ri);
if(xmlInputSource != null) {
fISCreatedByResolver = true;
}
}
if(xmlInputSource != null){
//wrap this XMLInputSource to StaxInputSource
staxInputSource = new StaxXMLInputSource(xmlInputSource, fISCreatedByResolver);
}
// do default resolution
//this works for both stax & Xerces, if staxInputSource is null, it means parser need to revert to default resolution
if (staxInputSource == null) {
// REVISIT: when systemId is null, I think we should return null.
// is this the right solution? -SG
//if (systemId != null)
staxInputSource = new StaxXMLInputSource(new XMLInputSource(publicId, literalSystemId, baseSystemId));
}else if(staxInputSource.hasXMLStreamOrXMLEventReader()){
//Waiting for the clarification from EG. - nb
}
if (DEBUG_RESOLVER) {
System.err.println("XMLEntityManager.resolveEntity(" + publicId + ")");