本文整理汇总了C#中IXmlNode.SelectSingleNode方法的典型用法代码示例。如果您正苦于以下问题:C# IXmlNode.SelectSingleNode方法的具体用法?C# IXmlNode.SelectSingleNode怎么用?C# IXmlNode.SelectSingleNode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IXmlNode
的用法示例。
在下文中一共展示了IXmlNode.SelectSingleNode方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadConferenceData
private void LoadConferenceData(IXmlNode nodeConference)
{
Conference.Title = nodeConference.SelectSingleNode("title").InnerText;
Conference.Subtitle = nodeConference.SelectSingleNode("subtitle").InnerText;
Conference.Venue = nodeConference.SelectSingleNode("venue").InnerText;
Conference.City = nodeConference.SelectSingleNode("city").InnerText;
Conference.Start = DateTime.Parse(nodeConference.SelectSingleNode("start").InnerText);
Conference.End = DateTime.Parse(nodeConference.SelectSingleNode("end").InnerText);
Conference.NumberOfDays = int.Parse(nodeConference.SelectSingleNode("days").InnerText);
Conference.DayChange = TimeSpan.Parse(nodeConference.SelectSingleNode("day_change").InnerText);
Conference.TimeslotDuration = TimeSpan.Parse(nodeConference.SelectSingleNode("timeslot_duration").InnerText);
}
示例2: noReadFeedItemXml
private void noReadFeedItemXml(IXmlNode itemXml) {
itemXml.SelectSingleNode("isread").InnerText = "false";
}
示例3: readedFeedItemXml
private void readedFeedItemXml(IXmlNode itemXml) {
itemXml.SelectSingleNode("isread").InnerText = "true";
}
示例4: LoadConferenceEventData
private void LoadConferenceEventData(IXmlNode nodeEvent, Day day, Room room)
{
Event conferenceEvent = new Event();
conferenceEvent.Id = nodeEvent.Attributes.GetNamedItem("id").InnerText;
conferenceEvent.Start = day.Date.Add(DateTime.Parse(nodeEvent.SelectSingleNode("start").InnerText).TimeOfDay);
conferenceEvent.Duration = TimeSpan.Parse(nodeEvent.SelectSingleNode("duration").InnerText);
conferenceEvent.Room = room;
conferenceEvent.Day = day;
conferenceEvent.Slug = nodeEvent.SelectSingleNode("slug").InnerText;
conferenceEvent.Title = nodeEvent.SelectSingleNode("title").InnerText;
conferenceEvent.Subtitle = nodeEvent.SelectSingleNode("subtitle").InnerText;
string trackName = nodeEvent.SelectSingleNode("track").InnerText;
conferenceEvent.Track = Conference.Tracks.FirstOrDefault(item => item.Name == trackName);
if (conferenceEvent.Track == null)
{
conferenceEvent.Track = new Track() { Name = trackName };
Conference.Tracks.Add(conferenceEvent.Track);
}
string typeName = nodeEvent.SelectSingleNode("type").InnerText;
conferenceEvent.Type = Conference.EventTypes.FirstOrDefault(item => item.Name == typeName);
if (conferenceEvent.Type == null)
{
conferenceEvent.Type = new EventType() { Name = typeName };
Conference.EventTypes.Add(conferenceEvent.Type);
}
conferenceEvent.Language = nodeEvent.SelectSingleNode("language").InnerText;
conferenceEvent.Abstract = nodeEvent.SelectSingleNode("abstract").InnerText;
conferenceEvent.Description = nodeEvent.SelectSingleNode("description").InnerText;
conferenceEvent.Persons = new List<Person>();
IXmlNode nodesPersons = nodeEvent.SelectSingleNode("persons");
XmlNodeList nodesPersonList = nodesPersons.SelectNodes("person");
foreach (IXmlNode item in nodesPersonList)
{
Person person = LoadConferencePersonData(item);
conferenceEvent.Persons.Add(person);
}
conferenceEvent.Links = new List<Link>();
IXmlNode nodesLinks = nodeEvent.SelectSingleNode("links");
XmlNodeList nodesLinkList = nodesLinks.SelectNodes("link");
foreach (IXmlNode item in nodesLinkList)
{
Link link = new Link();
link.Name = item.InnerText;
link.Url = item.Attributes.GetNamedItem("href").InnerText;
conferenceEvent.Links.Add(link);
}
Conference.Events.Add(conferenceEvent);
}