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


C# XmlDocument.NodeGet方法代码示例

本文整理汇总了C#中System.Xml.XmlDocument.NodeGet方法的典型用法代码示例。如果您正苦于以下问题:C# XmlDocument.NodeGet方法的具体用法?C# XmlDocument.NodeGet怎么用?C# XmlDocument.NodeGet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Xml.XmlDocument的用法示例。


在下文中一共展示了XmlDocument.NodeGet方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Yandex

 private XmlNode Yandex()
 {
     if (DateTime.Now >= _cTemplate.dtNext)
     {
         int nBuild;
         XmlNode cResult;
         XmlNode[] aItems;
         XmlDocument cXmlDocument = new XmlDocument();
         cXmlDocument.LoadXml((new System.Net.WebClient() { Encoding = Encoding.UTF8 }).DownloadString("http://news.yandex.ru/index.rss"));
         nBuild = cXmlDocument.NodeGet("rss/channel/lastBuildDate").InnerText.GetHashCode();
         if (_cTemplate.nBuild != nBuild)
         {
             aItems = cXmlDocument.NodesGet("rss/channel/item", false);
             if (null != aItems)
             {
                 _cTemplate.nBuild = nBuild;
                 cXmlDocument = new XmlDocument();
                 cResult = cXmlDocument.CreateNode(XmlNodeType.Element, "result", null);
                 XmlNode cXNItem;
                 foreach (string sItem in aItems.Select(o => o.NodeGet("title").InnerText).ToArray())
                 {
                     cXNItem = cXmlDocument.CreateNode(XmlNodeType.Element, "item", null);
                     cXNItem.InnerText = sItem.StripTags() + ".    ";
                     cResult.AppendChild(cXNItem);
                 }
                 _cTemplate.cValue = cResult;
                 _cTemplate.dt = DateTime.Now;
             }
             else
                 (new Logger()).WriteWarning("can't get any news from rss");
         }
     }
     return _cTemplate.cValue;
 }
开发者ID:ratsil,项目名称:bethe.ingenie,代码行数:34,代码来源:Data.cs

示例2: Preferences

        public Preferences(string sData)
        {
            XmlDocument cXmlDocument = new XmlDocument();
            cXmlDocument.LoadXml(sData);
            XmlNode cXmlNode = cXmlDocument.NodeGet("data");

            XmlNode cNodeChild = cXmlNode.NodeGet("playlist");
            _bCuda = cNodeChild.AttributeGet<bool>("cuda");
            _nLayer = cNodeChild.AttributeGet<ushort>("layer");
            cNodeChild = cNodeChild.NodeGet("area");
            _stArea = new Area(
                    cNodeChild.AttributeGet<short>("left"),
                    cNodeChild.AttributeGet<short>("top"),
                    cNodeChild.AttributeGet<ushort>("width"),
                    cNodeChild.AttributeGet<ushort>("height")
                );
        }
开发者ID:ratsil,项目名称:bethe.ingenie,代码行数:17,代码来源:Preferences.cs

示例3: Zed

				private XmlNode Zed(string sName)
				{
					if (DateTime.Now >= _cTemplate.dtNext)
					{
						int nBuild;
						XmlNode cResult, cXN, cXNChild;
						XmlAttribute cXA;
						XmlNode cXNPoll;
						XmlDocument cXmlDocument = new XmlDocument();
						cXmlDocument.LoadXml((new System.Net.WebClient() { Encoding = Encoding.UTF8 }).DownloadString("http://tvscope2014.agregator.ru/out/out_votings_one_results.phtml?dtStart=01.04.2015&dtEnd=01.04.2016"));
						nBuild = cXmlDocument.InnerXml.GetHashCode();
						if (_cTemplate.nBuild != nBuild)
						{
							string sValue;
							if (null != (cXNPoll = cXmlDocument.NodeGet("votings/voting", false)))
							{
								_cTemplate.nBuild = nBuild;
								cXmlDocument = new XmlDocument();
								cResult = cXmlDocument.CreateNode(XmlNodeType.Element, "result", null);

								if (sName.ToLower() != cXNPoll.AttributeValueGet("name").ToLower())
									throw new Exception("specified poll does not exist");
								foreach (XmlNode cXNVariant in cXNPoll.NodesGet("variant", false))
								{
									cXN = cXmlDocument.CreateNode(XmlNodeType.Element, "item", null);

									cXA = cXmlDocument.CreateAttribute("name");
									cXA.Value = cXNVariant.AttributeValueGet("name");
									cXN.Attributes.Append(cXA);
									cXA = cXmlDocument.CreateAttribute("votes");
									cXA.Value = cXNVariant.AttributeValueGet("votes");
									cXN.Attributes.Append(cXA);

									cResult.AppendChild(cXN);
								}

								_cTemplate.cValue = cResult;
								_cTemplate.dt = DateTime.Now;
							}
							else
								(new Logger()).WriteWarning("can't get any poll");
						}
					}
					return _cTemplate.cValue;
				}
开发者ID:ratsil,项目名称:bethe.ingenie,代码行数:45,代码来源:Data.cs


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