// <attribute name="foo" type="xs:int"/>
// </>
//
// or it could also be an in-lined type (attr ref)
//
LocalAttribute localAttribute = attr.attribute();
final String attrURI = ap.getXmlName().getNamespaceURI();
if (attrURI.equals("") || attrURI.equals(uri)) {
localAttribute.name(ap.getXmlName().getLocalPart());
TypeHost th; String refAtt;
if( ap.isCollection() ) {
th = localAttribute.simpleType().list();
refAtt = "itemType";
} else {
th = localAttribute;
refAtt = "type";
}
writeTypeRef(th, ap, refAtt);
attributeFormDefault.writeForm(localAttribute,ap.getXmlName());
} else { // generate an attr ref
localAttribute.ref(ap.getXmlName());
}
if(ap.isRequired()) {
// TODO: not type safe
localAttribute.use("required");
}
}