示例#1
0
 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);
     }
 }
示例#2
0
 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);
     }
 }