final XMLReader reader = parser.getXMLReader();
final XmlFactoryModule[] rootHandlers = getModules();
final ResourceDataInputSource input = new ResourceDataInputSource(data, manager);
final ResourceKey contextKey;
final long version;
final ResourceKey targetKey = data.getKey();
if (context == null)
{
contextKey = targetKey;
version = data.getVersion(manager);
}
else
{
contextKey = context;
version = -1;
}
final MultiplexRootElementHandler handler =
new MultiplexRootElementHandler(manager, targetKey,
contextKey, version, rootHandlers);
final DefaultConfiguration parserConfiguration = handler.getParserConfiguration();
final URL value = manager.toURL(contextKey);
if (value != null)
{
parserConfiguration.setConfigProperty(CONTENTBASE_KEY, value.toExternalForm());
}
configureReader(reader, handler);
reader.setContentHandler(handler);
reader.setDTDHandler(handler);
reader.setEntityResolver(handler.getEntityResolver());
reader.setErrorHandler(getErrorHandler());
final Map parameters = targetKey.getFactoryParameters();
final Iterator it = parameters.keySet().iterator();
while (it.hasNext())
{
final Object o = it.next();
if (o instanceof FactoryParameterKey)