/// <summary> /// returns the value of the attribute. /// </summary> /// <returns> the value of the attribute. </returns> public virtual T GetValue <T>(IModelElementInstance modelElement) { string value; if (NamespaceUri == null) { value = modelElement.GetAttributeValue(AttributeName); } else { value = modelElement.GetAttributeValueNs(NamespaceUri, AttributeName); if (value == null) { string alternativeNamespace = _owningElementType.Model.GetAlternativeNamespace(NamespaceUri); if (alternativeNamespace != null) { value = modelElement.GetAttributeValueNs(alternativeNamespace, AttributeName); } } } if ((value == null) && _defaultValue != null) { return(GetDefaultValue <T>()); } return(ConvertXmlValueToModelValue <T>(value)); }
public override string GetReferenceIdentifier(IModelElementInstance referenceSourceElement) { // TODO: implement something more robust (CAM-4028) string identifier = referenceSourceElement.GetAttributeValue("href"); if (string.IsNullOrEmpty(identifier)) { return(null); } string[] parts = identifier.Split('#'); if (parts.Length > 1) { return(parts[parts.Length - 1]); } return(parts[0]); }