- protected Inheritance getElementInheritance(SchemaObject topLevelElementObj) {\r
- Element topLevelElement = topLevelElementObj.getElement();\r
- Inheritance inheritance = new Inheritance(getBaseClass());\r
- if (topLevelElement.getType() != null) {\r
- QName type = topLevelElement.getType();\r
- if (!type.getNamespaceURI().equals(SCHEMA_NS)) {\r
- SchemaObject obj = complexTypeName.get(type.getLocalPart());\r
-// if (obj == null)\r
-// obj = simpleTypeName.get(type.getLocalPart());\r
- if (obj != null) {\r
- inheritance.baseClass = getName(obj);\r
- inheritance.type = InheritanceType.ComplexType;\r
- }\r
- } else {\r
- TypeEntry entry = getTypeEntry(type);\r
- if (entry != null) {\r
- inheritance.type = InheritanceType.AtomicType;\r
- inheritance.atomicType = entry;\r
- }\r
- }\r
- }\r
- if (inheritance.type == InheritanceType.None) {\r
- QName type = getElementBase(topLevelElement);\r
- if (type != null) {\r
- if (!type.getNamespaceURI().equals(SCHEMA_NS)) {\r
- SchemaObject obj = getWithName(topLevelElementObj, type.getLocalPart());\r
- inheritance.baseClass = getName(obj);\r
- inheritance.type = InheritanceType.ComplexType;\r
- } else {\r
- TypeEntry entry = getTypeEntry(type);\r
- if (entry != null) {\r
- inheritance.type = InheritanceType.AtomicType;\r
- inheritance.atomicType = entry;\r
- }\r
- }\r
- }\r
- }\r
- if (inheritance.type == InheritanceType.None) {\r
- QName type = topLevelElement.getSubstitutionGroup();\r
- if (type != null) {\r
- if (!type.getNamespaceURI().equals(SCHEMA_NS)) {\r
- SchemaObject obj = getWithName(topLevelElementObj, type.getLocalPart());\r
- inheritance.baseClass = getName(obj);\r
- inheritance.type = InheritanceType.ComplexType;\r
- } else {\r
- TypeEntry entry = getTypeEntry(type);\r
- if (entry != null) {\r
- inheritance.type = InheritanceType.AtomicType;\r
- inheritance.atomicType = entry;\r
- }\r
- }\r
- }\r
- }\r
- \r
- return inheritance;\r
- } \r