当前位置: 首页>>代码示例>>C#>>正文


C# IXmlNode.SelectSingleNode方法代码示例

本文整理汇总了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);
 }
开发者ID:julianls,项目名称:FOSDEM,代码行数:12,代码来源:ModelLoader.cs

示例2: noReadFeedItemXml

 private void noReadFeedItemXml(IXmlNode itemXml) {
     itemXml.SelectSingleNode("isread").InnerText = "false";
 }
开发者ID:edwardpan,项目名称:MarkRSSReader,代码行数:3,代码来源:FeedItemDatabase.cs

示例3: readedFeedItemXml

 private void readedFeedItemXml(IXmlNode itemXml) {
     itemXml.SelectSingleNode("isread").InnerText = "true";
 }
开发者ID:edwardpan,项目名称:MarkRSSReader,代码行数:3,代码来源:FeedItemDatabase.cs

示例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);
        }
开发者ID:julianls,项目名称:FOSDEM,代码行数:51,代码来源:ModelLoader.cs


注:本文中的IXmlNode.SelectSingleNode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。