}
public void validate(Source source, Result result)
throws SAXException, IOException {
if (result instanceof StreamResult || result == null) {
final StreamSource streamSource = (StreamSource) source;
final StreamResult streamResult = (StreamResult) result;
XMLInputSource input = new XMLInputSource(streamSource.getPublicId(), streamSource.getSystemId(), null);
input.setByteStream(streamSource.getInputStream());
input.setCharacterStream(streamSource.getReader());
// Gets the parser configuration. We'll create and initialize a new one, if we
// haven't created one before or if the previous one was garbage collected.
boolean newConfig = false;
XMLParserConfiguration config = (XMLParserConfiguration) fConfiguration.get();