// iterate all attributes on the Complex type. all attributes on a
// complex type (from all of xs:attribute & xs:attributeGroup
// declarations) are expanded, into an XSObjectList list.
XSObjectList attributeUses = complexTypeDecl.getAttributeUses();
for (int attrUsesIdx = 0; attrUsesIdx < attributeUses.getLength(); attrUsesIdx++) {
XSAttributeUse attrUse = (XSAttributeUse) attributeUses.item(attrUsesIdx);
String constraintName = null;
String constraintVal = null;
if (attrUse.getConstraintType() != XSConstants.VC_NONE) {
constraintName = (attrUse.getConstraintType() ==
XSConstants.VC_DEFAULT) ?
"default" : "fixed";
constraintVal = attrUse.getConstraintValue();
}
String requiredVal = (attrUse.getRequired() == true) ?
"required" : "optional";
XSAttributeDecl attrDecl = (XSAttributeDecl)
attrUse.getAttrDeclaration();
XSComplexTypeDefinition enclosingCTDefn = attrDecl.
getEnclosingCTDefinition();
boolean complexTypesIdentical = XSTypeHelper.schemaTypesIdentical(
complexTypeDecl,
enclosingCTDefn);