if (!grandKidName.equals(SchemaSymbols.ELT_RESTRICTION)) {
reportSchemaError("src-redefine.5.a.b", new Object[]{grandKidName}, child);
}
else {
Object[] attrs = fAttributeChecker.checkAttributes(grandKid, false, currSchema);
QName derivedBase = (QName)attrs[XSAttributeChecker.ATTIDX_BASE];
if (derivedBase == null ||
derivedBase.uri != currSchema.fTargetNamespace ||
!derivedBase.localpart.equals(oldName)) {
reportSchemaError("src-redefine.5.a.c",
new Object[]{grandKidName,
(currSchema.fTargetNamespace==null?"":currSchema.fTargetNamespace)
+ "," + oldName},
child);
}
else {
// now we have to do the renaming...
if (derivedBase.prefix != null && derivedBase.prefix.length() > 0)
grandKid.setAttribute( SchemaSymbols.ATT_BASE,
derivedBase.prefix + ":" + newName );
else
grandKid.setAttribute( SchemaSymbols.ATT_BASE, newName );
// return true;
}
fAttributeChecker.returnAttrArray(attrs, currSchema);
}
}
}
}
else if (componentType.equals(SchemaSymbols.ELT_COMPLEXTYPE)) {
Element grandKid = DOMUtil.getFirstChildElement(child);
if (grandKid == null) {
reportSchemaError("src-redefine.5.b.a", null, child);
}
else {
if (DOMUtil.getLocalName(grandKid).equals(SchemaSymbols.ELT_ANNOTATION)) {
grandKid = DOMUtil.getNextSiblingElement(grandKid);
}
if (grandKid == null) {
reportSchemaError("src-redefine.5.b.a", null, child);
}
else {
// have to go one more level down; let another pass worry whether complexType is valid.
Element greatGrandKid = DOMUtil.getFirstChildElement(grandKid);
if (greatGrandKid == null) {
reportSchemaError("src-redefine.5.b.b", null, grandKid);
}
else {
String greatGrandKidName = DOMUtil.getLocalName(greatGrandKid);
if (greatGrandKidName.equals(SchemaSymbols.ELT_ANNOTATION)) {
greatGrandKid = DOMUtil.getNextSiblingElement(greatGrandKid);
}
if (greatGrandKid == null) {
reportSchemaError("src-redefine.5.b.b", null, grandKid);
}
else {
greatGrandKidName = DOMUtil.getLocalName(greatGrandKid);
if (!greatGrandKidName.equals(SchemaSymbols.ELT_RESTRICTION) &&
!greatGrandKidName.equals(SchemaSymbols.ELT_EXTENSION)) {
reportSchemaError("src-redefine.5.b.c", new Object[]{greatGrandKidName}, greatGrandKid);
}
else {
Object[] attrs = fAttributeChecker.checkAttributes(greatGrandKid, false, currSchema);
QName derivedBase = (QName)attrs[XSAttributeChecker.ATTIDX_BASE];
if (derivedBase == null ||
derivedBase.uri != currSchema.fTargetNamespace ||
!derivedBase.localpart.equals(oldName)) {
reportSchemaError("src-redefine.5.b.d",
new Object[]{greatGrandKidName,