// If the start document event has been seen on the child pipeline it
// means the resource was successfully opened and we started reporting
// document events. If an IOException is thrown after the start document
// event we had a failure midstream and cannot recover.
if (fHasIncludeReportedContent) {
throw new XNIException(e);
}
// In other circumstances an IOException indicates that we had trouble
// accessing or opening the file, not that it was an invalid XML file. So we
// send a resource error, not a fatal error.
reportResourceError(
"XMLResourceError",
new Object[] { href, e.getMessage()}, e);
return false;
}
finally {
fNamespaceContext.popScope();
}
}
else if (parse.equals(XINCLUDE_PARSE_TEXT)) {
// we only care about encoding for parse="text"
String encoding = attributes.getValue(XINCLUDE_ATTR_ENCODING);
includedSource.setEncoding(encoding);
XIncludeTextReader textReader = null;
try {
fHasIncludeReportedContent = false;
// Setup the appropriate text reader.
if (!fIsXML11) {
if (fXInclude10TextReader == null) {
fXInclude10TextReader = new XIncludeTextReader(includedSource, this, fBufferSize);
}
else {
fXInclude10TextReader.setInputSource(includedSource);
}
textReader = fXInclude10TextReader;
}
else {
if (fXInclude11TextReader == null) {
fXInclude11TextReader = new XInclude11TextReader(includedSource, this, fBufferSize);
}
else {
fXInclude11TextReader.setInputSource(includedSource);
}
textReader = fXInclude11TextReader;
}
textReader.setErrorReporter(fErrorReporter);
textReader.parse();
}
// encoding errors
catch (MalformedByteSequenceException ex) {
fErrorReporter.reportError(ex.getDomain(), ex.getKey(),
ex.getArguments(), XMLErrorReporter.SEVERITY_FATAL_ERROR, ex);
}
catch (CharConversionException e) {
fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,
"CharConversionFailure", null, XMLErrorReporter.SEVERITY_FATAL_ERROR, e);
}
catch (IOException e) {
// If a characters event has already been sent down the pipeline it
// means the resource was successfully opened and that this IOException
// is from a failure midstream from which we cannot recover.
if (fHasIncludeReportedContent) {
throw new XNIException(e);
}
reportResourceError(
"TextResourceError",
new Object[] { href, e.getMessage()}, e);
return false;