// jaxb/22d0
if (_accessor.getAnnotation(XmlID.class) != null)
typeName = "xsd:ID";
// look for the XmlSchemaType
XmlSchemaType xmlSchemaType =
_accessor.getAnnotation(XmlSchemaType.class);
if (xmlSchemaType == null) {
xmlSchemaType = _accessor.getPackageAnnotation(XmlSchemaType.class);
if (xmlSchemaType != null) {
if (XmlSchemaType.DEFAULT.class.equals(xmlSchemaType.type()))
throw new JAXBException(L.l("@XmlSchemaType with name {0} on package {1} does not specify type", xmlSchemaType.name(), _accessor.getPackage().getName()));
if (! _accessor.getType().equals(xmlSchemaType.type()))
xmlSchemaType = null;
}
}
if (xmlSchemaType == null) {
XmlSchemaTypes xmlSchemaTypes =
_accessor.getPackageAnnotation(XmlSchemaTypes.class);
if (xmlSchemaTypes != null) {
XmlSchemaType[] array = xmlSchemaTypes.value();
for (int i = 0; i < array.length; i++) {
xmlSchemaType = array[i];
if (XmlSchemaType.DEFAULT.class.equals(xmlSchemaType.type()))
throw new JAXBException(L.l("@XmlSchemaType with name {0} on package {1} does not specify type", xmlSchemaType.name(), _accessor.getPackage().getName()));
if (_accessor.getType().equals(xmlSchemaType.type()))
break;
xmlSchemaType = null;
}
}
}
if (xmlSchemaType != null) {
QName typeQName = new QName(xmlSchemaType.namespace(),
xmlSchemaType.name());
typeName = StaxUtil.qnameToString(out, typeQName);
}
out.writeAttribute("type", typeName);
out.writeAttribute("name", _qname.getLocalPart());