{
ElementType type = this.type;
if( type == null )
{
final EditorPageDef def = getDefinition( this.pageDefinitionId ).resolve();
if( def == null )
{
throw new IllegalStateException();
}
final JavaType elementJavaType = def.getElementType().target();
type = ElementType.read( (Class<?>) elementJavaType.artifact(), true );
}
final XmlEditorResourceStore store = createResourceStore( this.sourcePage );
return type.instantiate( new RootXmlResource( store ) );