Attributes attributes)
throws SAXException {
// factor the adapter that should be added to the pipeline
AdapterProcess process = createAdapterProcess(dynamicProcess);
if (process != null) {
XMLPipeline pipeline = dynamicProcess.getPipeline();
if (pipeline instanceof XMLPipelineProcessImpl) {
// pass the details of the element to the process
process.setElementDetails(element.getNamespaceURI(),
element.getLocalName(),
calculateQName(dynamicProcess,
element));
// add the AdapterProcess to the pipeline.
((XMLPipelineProcessImpl)pipeline).addHeadProcess(process,
attributes);
} else {
// Need the pipeline to be an instance of
// XMLPipelineProcessImpl but wasn't. Deliver a fatal error
// down the pipeline.
XMLPipelineContext context = pipeline.getPipelineContext();
XMLPipelineException error = new XMLPipelineException(
"Expected pipeline to be instance of " +
"XMLPipelineProcessImpl, but was " +
pipeline.getClass(),
context.getCurrentLocator());
// send the error down the pipeline
pipeline.getPipelineProcess().fatalError(error);
}
}
// return the process that was added
return process;
}