{
// Get the ParserManager
ParserManager manager = _getDefaultManager();
// Create the builder.
TreeBuilder builder = new TreeBuilder(manager, expectedClass);
// Set up the parse context
ParseContextImpl parseContext = new ParseContextImpl();
// Transfer properties from the ImageContext to the ParseContext
ResourceBundle bundle = (ResourceBundle)context.getProperty(
ImageConstants.TECATE_NAMESPACE,
XMLConstants.RESOURCE_BUNDLE_PROPERTY);
if (bundle != null)
{
parseContext.setProperty(ImageConstants.TECATE_NAMESPACE,
XMLConstants.RESOURCE_BUNDLE_PROPERTY,
bundle);
}
parseContext.setProperty(ImageConstants.TECATE_NAMESPACE,
XMLConstants.LOCALE_CONTEXT_PROPERTY,
context.getLocaleContext());
// Parse it!
return builder.parse(provider, source, parseContext);
}