public LinkItem GetLinkById(string id) { var item = new LinkItem(); var doc = Doc(); var links = doc.SelectSingleNode("links"); if (links == null) { return(item); } var node = doc.SelectSingleNode(string.Format("links/link[@id='{0}']", id)); if (node != null) { item.Id = node.Attributes["id"].Value; item.Url = node.Attributes["url"].Value; item.Target = node.Attributes["target"].Value; item.Title = node.InnerText; } return(item); }
public List<LinkItem> GetLinks() { var items = new List<LinkItem>(); var doc = Doc(); var links = doc.SelectSingleNode("links"); if (links != null) { if(links.ChildNodes != null && links.ChildNodes.Count > 0) { foreach (var node in links.ChildNodes) { var item = new LinkItem(); var x = (XmlNode)node; item.Id = x.Attributes["id"].Value; item.Url = x.Attributes["url"].Value; item.Target = x.Attributes["target"].Value; item.Title = x.InnerText; items.Add(item); } } } return items; }
public List <LinkItem> GetLinks() { var items = new List <LinkItem>(); var doc = Doc(); var links = doc.SelectSingleNode("links"); if (links != null) { if (links.ChildNodes != null && links.ChildNodes.Count > 0) { foreach (var node in links.ChildNodes) { var item = new LinkItem(); var x = (XmlNode)node; item.Id = x.Attributes["id"].Value; item.Url = x.Attributes["url"].Value; item.Target = x.Attributes["target"].Value; item.Title = x.InnerText; items.Add(item); } } } return(items); }
public LinkItem GetLinkById(string id) { var item = new LinkItem(); var doc = Doc(); var links = doc.SelectSingleNode("links"); if (links == null) { return item; } var node = doc.SelectSingleNode(string.Format("links/link[@id='{0}']", id)); if (node != null) { item.Id = node.Attributes["id"].Value; item.Url = node.Attributes["url"].Value; item.Target = node.Attributes["target"].Value; item.Title = node.InnerText; } return item; }