public static List <string> getKeyNames() { List <string> names = new List <string>(); XDocument doc = XMLService.getDocument(path); var xElements = doc.Element("root").Elements(xElementName); foreach (XElement element in xElements) { names.Add(element.Attribute("name").Value); } return(names); }
public static IEnumerable getData() { IEnumerable data = null; try { XDocument doc = XMLService.getDocument(path); XElement rootElement = doc.Element("root"); var xElements = doc.Element("root").Elements(xElementName); var xmlData = xElements.Select(p => new { Nazwa = p.Attribute("name").Value, Klucz = p.Attribute("pubKey").Value, Notatka = p.Attribute("note").Value }); data = xmlData.ToList(); } catch (Exception ex) { LogService.add(ex.ToString()); data = null; } return(data); }