* passed in {@code AttributeMap}.
*/
private Type createType(Node node, AttributeMap attrMap, boolean forParam, Type defaultType) {
Attribute gxpType = attrMap.getAttribute(GxpNamespace.INSTANCE, "type");
Attribute contentType = attrMap.getAttribute(NullNamespace.INSTANCE, "content-type");
MultiLanguageAttrValue nativeType = attrMap.getMultiLanguageAttrValue("type");
// check for conflicting attributes
if (gxpType != null && contentType != null) {
alertSink.add(new ConflictingAttributesError(node, gxpType, contentType));
}
if ((gxpType != null || contentType != null) && !nativeType.isEmpty()) {
Attribute conflict = (gxpType != null) ? gxpType : contentType;
for (OutputLanguageNamespace ns : AttributeMap.getOutputLanguageNamespaces()) {
Attribute nsAttr = attrMap.getAttribute(ns, "type");
if (nsAttr != null) {
alertSink.add(new ConflictingAttributesError(node, conflict, nsAttr));
}
}
Attribute defaultTypeAttr = attrMap.getAttribute("type");
if (defaultTypeAttr != null) {
alertSink.add(new ConflictingAttributesError(node, conflict, defaultTypeAttr));
}
}
// build an appropriate type
Type type = (gxpType != null) ? createGxpType(node, attrMap, gxpType)
: (contentType != null) ? createContentType(node, null)
: (defaultType == null || !nativeType.isEmpty()) ? new NativeType(node, nativeType)
: defaultType;
if (type != null && type.onlyAllowedInParam() && !forParam) {
alertSink.add(new InvalidTypeError(type));
type = null;