CMElementDeclaration result = modelQuery
.getCMElementDeclaration((Element) node);
// If the XSD is not found this check will fail.
if (result instanceof XSDElementDeclarationAdapter) {
XSDElementDeclarationImpl elementDeclaration = (XSDElementDeclarationImpl) ((XSDElementDeclarationAdapter) result)
.getKey();
ComponentDefinition componentDefinition = null;
// 1. Get component definition for directly attached
// annotations.
if (elementDeclaration.getAnnotation() != null) {
componentDefinition = processAnnotations(element,
elementDeclaration.getAnnotation()
.getApplicationInformation(), parserContext);
}
// 2. If no directly attached annotation could be
// found, try the referenced type definition if any.
if (componentDefinition == null
&& elementDeclaration.getTypeDefinition() != null
&& elementDeclaration.getTypeDefinition().getAnnotation() != null) {
componentDefinition = processAnnotations(element,
elementDeclaration.getTypeDefinition().getAnnotation()
.getApplicationInformation(), parserContext);
}
return componentDefinition;