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


C# System.Xml.XmlTextReader.ReadElementString方法代码示例

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


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

示例1: Get_Definephrase

        public static string Get_Definephrase(string tag)
        {
            try
            {
                string ffile = "/cmm/xhtml/Definephrase.xml";
                string fpath = HttpContext.Current.Server.MapPath(ffile);
                if (!System.IO.File.Exists(fpath)) return "";

                string vlreturn = "";
                System.Xml.XmlTextReader rdr = new System.Xml.XmlTextReader(fpath);
                while (rdr.Read())
                {
                    switch (rdr.NodeType)
                    {
                        case System.Xml.XmlNodeType.Element:
                            if (rdr.Name == LANG + tag)
                            {
                                vlreturn = rdr.ReadElementString();
                                goto lexit;
                            }
                            else if (rdr.Name != "phrase")
                                rdr.Skip();
                            break;
                        default:
                            break;
                    }
                }
            lexit:
                rdr.Close();
                return vlreturn;
            }
            catch
            {
                return "Cannot get phrase";
            }
        }
开发者ID:thienchi,项目名称:my-bfinance,代码行数:36,代码来源:CCommon.cs

示例2: ProcessFiles

      /// <summary>
      /// This is the worker thread.
      /// </summary>
      /// <param name="stateInfo">Not used.</param>
      void ProcessFiles(object stateInfo)
      {

        System.Text.StringBuilder stb = null;

        while (_filesToProcess.Count > 0)
        {
          string fullfilename = _filesToProcess.Dequeue();
          try
          {
            string category = null;
            string name = null;
            DateTime creationTime = DateTime.MinValue;
            string description = string.Empty;

            System.Xml.XmlTextReader xmlReader = new System.Xml.XmlTextReader(fullfilename);
            xmlReader.MoveToContent();
            while (xmlReader.Read())
            {
              if (xmlReader.NodeType == System.Xml.XmlNodeType.Element && xmlReader.LocalName == "Category")
              {
                category = xmlReader.ReadElementString();
                name = xmlReader.ReadElementString("Name");
                creationTime = System.Xml.XmlConvert.ToDateTime(xmlReader.ReadElementString("CreationTime"), System.Xml.XmlDateTimeSerializationMode.Local);
                if (xmlReader.LocalName == "Description")
                  description = xmlReader.ReadElementString("Description");
                break;
              }
            }
            xmlReader.Close();

            AddFitFunctionEntry(category, name, creationTime, description, fullfilename);

          }
          catch (Exception ex)
          {
            if (stb == null)
              stb = new StringBuilder();

            stb.AppendLine(ex.ToString());
          }
        }

        if (stb != null)
        {
          Current.Console.WriteLine("Exception(s) thrown in " + this.GetType().ToString() + " during parsing of fit functions, details will follow:");
          Current.Console.WriteLine(stb.ToString());
        }
        _threadIsWorking = false;
      }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:54,代码来源:FitFunctionService.cs


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