JAXBJavaType javaType = findJavaType(pSchema, pType);
SimpleTypeSGChain result;
if (javaType == null || javaType.getName() == null) {
XSSimpleType simpleType = pType.getSimpleType();
JavaQName runtimeType;
if (simpleType.isAtomic()) {
result = newGlobalAtomicTypeSG(pFactory, pSchema, pType);
if (result == null) {
if (!simpleType.isRestriction()) {
throw new SAXParseException("Atomic type must be either a builtin or a restriction of another atomic type",
pType.getLocator());
}
TypeSG type = pSchema.getType(simpleType.getRestrictedType().getName());
runtimeType = type.getSimpleTypeSG().getRuntimeType();
result = newAtomicTypeRestriction(pController, pFactory, pSchema, pType);
} else {
SimpleTypeSG simpleTypeSG = new SimpleTypeSGImpl(result);
simpleTypeSG.init();
runtimeType = simpleTypeSG.getRuntimeType();
}
if (javaType == null) {
JAXBJavaType[] globalJavaTypes = pSchema.getJAXBJavaTypes();
for (int i = 0; i < globalJavaTypes.length; i++) {
if (runtimeType.equals(globalJavaTypes[i].getName())) {
javaType = globalJavaTypes[i];
break;
}
}
}