TemplateModel from = (TemplateModel) list.get(0);
Object unwrapped = BeansWrapper.getDefaultInstance().unwrap(from);
String namespace;
String name;
if (LocalElementDeclaration.class.isInstance(unwrapped)) {
LocalElementDeclaration decl = (LocalElementDeclaration) unwrapped;
namespace = decl.getNamespace();
name = decl.getName();
}
else if (ImplicitSchemaElement.class.isInstance(unwrapped)) {
ImplicitSchemaElement ise = (ImplicitSchemaElement) unwrapped;
namespace = ise.getTargetNamespace();
name = ise.getElementName();