TemplateModel from = (TemplateModel) list.get(0);
Object unwrapped = BeansWrapper.getDefaultInstance().unwrap(from);
if (unwrapped instanceof Accessor) {
DecoratedTypeMirror accessorType = (DecoratedTypeMirror) ((Accessor) unwrapped).getBareAccessorType();
if (accessorType.isInstanceOf(JAXBElement.class.getName())) {
unwrapped = KnownXmlType.ANY_TYPE.getQname();
}
else if (unwrapped instanceof Element && ((Element)unwrapped).getRef() != null) {
unwrapped = ((Element) unwrapped).getRef();
}