LocalElement e = parent.element();
QName tn = t.getTagName();
PropertyInfo propInfo = t.getSource();
TypeInfo parentInfo = (propInfo == null) ? null : propInfo.parent();
if (canBeDirectElementRef(t, tn, parentInfo)) {
if ((!t.getTarget().isSimpleType()) && (t.getTarget() instanceof ClassInfo) && collisionChecker.findDuplicate((ClassInfo<T, C>) t.getTarget())) {
e.ref(new QName(uri, tn.getLocalPart()));
} else {
QName elemName = null;
if (t.getTarget() instanceof Element) {
Element te = (Element) t.getTarget();
elemName = te.getElementName();
}
Collection<TypeInfo> refs = propInfo.ref();
TypeInfo ti;
if ((refs != null) && (!refs.isEmpty()) && (elemName != null)
&& ((ti = refs.iterator().next()) == null || ti instanceof ClassInfoImpl)) {
ClassInfoImpl cImpl = (ClassInfoImpl)ti;
if ((cImpl != null) && (cImpl.getElementName() != null)) {
e.ref(new QName(cImpl.getElementName().getNamespaceURI(), tn.getLocalPart()));