if (type.isSimple()) {
throw new LocSAXException("Invalid 'restriction': The base type " + getName() + " is simple.", getLocator());
}
XsTTypeDefParticle particle = restriction.getTypeDefParticle();
XSGroup group = getGroupByParticle(particle);
if (group == null) {
// TODO: Restriction of the ur-type
complexContentParticle = null;
} else {
complexContentParticle = new XSParticleImpl(group);
}
complexContentType = getContentTypeByParticle(particle, group);
attributes = XSAttributeGroupImpl.getAttributes(XSTypeImpl.this, restriction);
restrictedType = type;
} else {
XsQName base = extension.getBase();
if (base == null) {
throw new LocSAXException("Invalid 'extension': Missing 'base' attribute", getLocator());
}
XSType type = getXSSchema().getType(base);
if (type == null) {
throw new LocSAXException("Invalid 'extension': Unknown base type " + base, getLocator());
}
if (type.isSimple()) {
throw new LocSAXException("Invalid 'extension': The base type " + base + " is simple.", getLocator());
}
XSComplexType extendedComplexType = type.getComplexType();
if (extendedComplexType.hasSimpleContent()) {
throw new LocSAXException("Invalid 'extension': The base type " + base + " has simple content.",
getLocator());
}
XsTTypeDefParticle particle = extension.getTypeDefParticle();
XSGroup group = getGroupByParticle(particle);
XsComplexContentType groupType = getContentTypeByParticle(particle, group);
if (XsComplexContentType.EMPTY.equals(groupType)) {
if (type == XSAnyType.getInstance()) {
complexContentType = null;
complexContentParticle = null;
} else {
complexContentType = extendedComplexType.getComplexContentType();
complexContentParticle = extendedComplexType.getParticle();
}
} else if (extendedComplexType.isEmpty()) {
complexContentType = groupType;
complexContentParticle = new XSParticleImpl(group);
} else {
XSGroup sequenceGroup = new ExtensionGroup(pOwner, new XSParticle[]{extendedComplexType.getParticle(), new XSParticleImpl(group)});
complexContentParticle = new XSParticleImpl(sequenceGroup);
complexContentType = groupType;
}
XSAttributable[] inheritedAttributes = extendedComplexType.getAttributes();