public void AssignName(IXElement element, string name) { if ((name != null) && (name.Trim().Length > 0)) { XAttributeLiteral attr = (XAttributeLiteral)ATTR_NAME.Clone(); attr.Value = name; element.GetAttributes().Add(QualifiedName(KEY_NAME), attr); } }
public string ExtractName(IXElement element) { try { return(((XAttributeLiteral)element.GetAttributes()[QualifiedName(KEY_NAME)]).Value); } catch (KeyNotFoundException) { XLogging.Log("Key '" + KEY_NAME + "' not available", XLogging.Importance.WARNING); return(null); } }