• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Xml.XmlTextReader类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: PhotoInfoParseFull

        public void PhotoInfoParseFull()
        {
            string x = "<photo id=\"7519320006\">"
                    + "<location latitude=\"54.971831\" longitude=\"-1.612683\" accuracy=\"16\" context=\"0\" place_id=\"Ke8IzXlQV79yxA\" woeid=\"15532\">"
                    + "<neighbourhood place_id=\"Ke8IzXlQV79yxA\" woeid=\"15532\">Central</neighbourhood>"
                    + "<locality place_id=\"DW0IUrFTUrO0FQ\" woeid=\"20928\">Gateshead</locality>"
                    + "<county place_id=\"myqh27pQULzLWcg7Kg\" woeid=\"12602156\">Tyne and Wear</county>"
                    + "<region place_id=\"2eIY2QFTVr_DwWZNLg\" woeid=\"24554868\">England</region>"
                    + "<country place_id=\"cnffEpdTUb5v258BBA\" woeid=\"23424975\">United Kingdom</country>"
                    + "</location>"
                    + "</photo>";

            System.IO.StringReader sr = new System.IO.StringReader(x);
            System.Xml.XmlTextReader xr = new System.Xml.XmlTextReader(sr);
            xr.Read();

            var info = new PhotoInfo();
            ((IFlickrParsable)info).Load(xr);

            Assert.AreEqual("7519320006", info.PhotoId);
            Assert.IsNotNull(info.Location);
            Assert.AreEqual((GeoAccuracy)16, info.Location.Accuracy);

            Assert.IsNotNull(info.Location.Country);
            Assert.AreEqual("cnffEpdTUb5v258BBA", info.Location.Country.PlaceId);
        }
开发者ID:JamieKitson,项目名称:flickrnet-experimental,代码行数:26,代码来源:PhotosGeoTests.cs


示例2: GetBytes

        /// <summary>
        /// Creates a byte array from the hexadecimal string. Each two characters are combined
        /// to create one byte. First two hexadecimal characters become first byte in returned array.
        /// Non-hexadecimal characters are ignored. 
        /// </summary>
        /// <param name="hexString">string to convert to byte array</param>
        /// <param name="discarded">number of characters in string ignored</param>
        /// <returns>byte array, in the same left-to-right order as the hexString</returns>
        public static byte[] GetBytes(string hexString, out int discarded)
        {
            discarded = 0;

            // XML Reader/Writer is highly optimized for BinHex conversions
            // use instead of byte/character replacement for performance on
            // arrays larger than a few dozen elements

            hexString = "<node>" + hexString + "</node>";

            System.Xml.XmlTextReader tr = new System.Xml.XmlTextReader(
                hexString,
                System.Xml.XmlNodeType.Element,
                null);

            tr.Read();

            System.IO.MemoryStream ms = new System.IO.MemoryStream();

            int bufLen = 1024;
            int cap = 0;
            byte[] buf = new byte[bufLen];

            do
            {
                cap = tr.ReadBinHex(buf, 0, bufLen);
                ms.Write(buf, 0, cap);
            } while (cap == bufLen);

            return ms.ToArray();
        }
开发者ID:AnthonyGilliam,项目名称:LikeMyDessert,代码行数:39,代码来源:HexEncoding.cs


示例3: Deserialize

 public static TransactionSpecification Deserialize(string xml)
 {
     System.IO.StringReader stringReader = new System.IO.StringReader(xml);
     System.Xml.XmlTextReader xmlTextReader = new System.Xml.XmlTextReader(stringReader);
     System.Xml.Serialization.XmlSerializer xmlSerializer = new System.Xml.Serialization.XmlSerializer(typeof(TransactionSpecification));
     return ((TransactionSpecification)(xmlSerializer.Deserialize(xmlTextReader)));
 }
开发者ID:hitgeek,项目名称:OopFactoryX12Parser,代码行数:7,代码来源:TransactionSpecification.cs


示例4: IsolatedStorage_Read_and_Write_Sample

        public static void IsolatedStorage_Read_and_Write_Sample()
        {
            string fileName = @"SelfWindow.xml";

            IsolatedStorageFile storFile = IsolatedStorageFile.GetUserStoreForDomain();
            IsolatedStorageFileStream storStream = new IsolatedStorageFileStream(fileName, FileMode.Create, FileAccess.Write);
            System.Xml.XmlWriter writer = new System.Xml.XmlTextWriter(storStream, Encoding.UTF8);
            writer.WriteStartDocument();

            writer.WriteStartElement("Settings");

            writer.WriteStartElement("UserID");
            writer.WriteValue(42);
            writer.WriteEndElement();
            writer.WriteStartElement("UserName");
            writer.WriteValue("kingwl");
            writer.WriteEndElement();

            writer.WriteEndElement();

            writer.Flush();
            writer.Close();
            storStream.Close();

            string[] userFiles = storFile.GetFileNames();

            foreach(var userFile in userFiles)
            {
                if(userFile == fileName)
                {
                    var storFileStreamnew =  new IsolatedStorageFileStream(fileName,FileMode.Open,FileAccess.Read);
                    StreamReader storReader = new StreamReader(storFileStreamnew);
                    System.Xml.XmlTextReader reader = new System.Xml.XmlTextReader(storReader);

                    int UserID = 0;
                    string UserName = null;

                    while(reader.Read())
                    {
                        switch(reader.Name)
                        {
                            case "UserID":
                                UserID = int.Parse(reader.ReadString());
                                break;
                            case "UserName":
                                UserName = reader.ReadString();
                                break;
                            default:
                                break;
                        }
                    }

                    Console.WriteLine("{0} {1}", UserID, UserName);

                    storFileStreamnew.Close();
                }
            }
            storFile.Close();
        }
开发者ID:xxy1991,项目名称:cozy,代码行数:59,代码来源:D8IsolatedStorageReadAndWrite.cs


示例5: LoadHighlightingDefinition

 private void LoadHighlightingDefinition()
 {
   var xshdUri = App.GetResourceUri("simai.xshd");
   var rs = Application.GetResourceStream(xshdUri);
   var reader = new System.Xml.XmlTextReader(rs.Stream);
   definition = HighlightingLoader.Load(reader, HighlightingManager.Instance);
   reader.Close();
 }
开发者ID:youaoi,项目名称:simaiAssistant,代码行数:8,代码来源:Editor.xaml.cs


示例6: Copy

		///<summary>
		///Create a full copy of the current properties
		///</summary>
		public MySection Copy()
		{
			MySection copy = new MySection();
			string xml = SerializeSection(this, "MySection", ConfigurationSaveMode.Full);
			System.Xml.XmlReader rdr = new System.Xml.XmlTextReader(new System.IO.StringReader(xml));
			copy.DeserializeSection(rdr);
			return copy;
		}
开发者ID:josecohenca,项目名称:xmlconvertsql,代码行数:11,代码来源:MySection.cs


示例7: Deserialize

        public static SegmentSet Deserialize(string xml)
        {
            System.IO.StringReader stringReader = new System.IO.StringReader(xml);
            System.Xml.XmlTextReader xmlTextReader = new System.Xml.XmlTextReader(stringReader);
            System.Xml.Serialization.XmlSerializer xmlSerializer = new System.Xml.Serialization.XmlSerializer(typeof(SegmentSet));

            return ((SegmentSet)(xmlSerializer.Deserialize(xmlTextReader)));
        }
开发者ID:hitgeek,项目名称:OopFactoryX12Parser,代码行数:8,代码来源:SegmentSet.cs


示例8: NameAndCasNmber

 static public string[] NameAndCasNmber(string compoundName)
 {
     string[] retVal = new string[2];
     gov.nih.nlm.chemspell.SpellAidService service = new gov.nih.nlm.chemspell.SpellAidService();
     string response = service.getSugList(compoundName, "All databases");
     var XMLReader = new System.Xml.XmlTextReader(new System.IO.StringReader(response));
     System.Xml.Serialization.XmlSerializer serializer = new System.Xml.Serialization.XmlSerializer(typeof(Synonym));
     if (serializer.CanDeserialize(XMLReader))
     {
         Synonym synonym = (Synonym)serializer.Deserialize(XMLReader);
         foreach (SynonymChemical chemical in synonym.Chemical)
         {
             int result = String.Compare(compoundName, chemical.Name, true);
             if (result == 0)
             {
                 retVal[0] = chemical.CAS;
                 retVal[1] = chemical.Name;
                 return retVal;
             }
         }
     }
     serializer = new System.Xml.Serialization.XmlSerializer(typeof(SpellAid));
     if (serializer.CanDeserialize(XMLReader))
     {
         SpellAid aid = (SpellAid)serializer.Deserialize(XMLReader);
         bool different = true;
         retVal[0] = aid.Chemical[0].CAS;
         retVal[1] = aid.Chemical[0].Name;
         for (int i = 0; i < aid.Chemical.Length - 1; i++)
         {
             if (retVal[0] != aid.Chemical[i + 1].CAS)
             {
                 different = false;
                 retVal[0] = aid.Chemical[i].CAS;
                 retVal[1] = aid.Chemical[i].Name;
             }
         }
         if (!different)
         {
             foreach (SpellAidChemical chemical in aid.Chemical)
             {
                 int result = String.Compare(compoundName, 0, chemical.Name, 0, compoundName.Length, true);
                 if (result == 0 && compoundName.Length >= chemical.Name.Length)
                 {
                     retVal[0] = chemical.CAS;
                     retVal[1] = chemical.Name;
                     return retVal;
                 }
             }
             SelectChemicalForm form = new SelectChemicalForm(aid, compoundName);
             form.ShowDialog();
             retVal[0] = form.SelectedChemical.CAS;
             retVal[1] = form.SelectedChemical.Name;
             return retVal;
         }
     }
     return retVal;
 }
开发者ID:wbarret1,项目名称:ChemicalDataSourcesTestApp,代码行数:58,代码来源:NistChemicalList.cs


示例9: GetXmlData

        public XmlActionResult GetXmlData()
        {
            LogInfo();

            System.Xml.XmlTextReader reader =
              new System.Xml.XmlTextReader(Server.MapPath("~/Book.xml"));
            var xml = XElement.Load(reader);
            return new XmlActionResult(xml.ToString(), "book.xml");
        }
开发者ID:sabotuer99,项目名称:ExtensibilityMVC,代码行数:9,代码来源:XmlController.cs


示例10: Unmarshall

        public override WebServiceResponse Unmarshall(XmlUnmarshallerContext context)
        {
            System.Xml.XmlTextReader reader = new System.Xml.XmlTextReader(context.ResponseStream);
            BatchReceiveMessageResponse batchReceiveMessageResponse = new BatchReceiveMessageResponse();
            Message message = null;

            while (reader.Read())
            {
                switch (reader.NodeType)
                {
                    case System.Xml.XmlNodeType.Element:
                        switch (reader.LocalName)
                        {
                            case MNSConstants.XML_ROOT_MESSAGE:
                                message = new Message();
                                break;
                            case MNSConstants.XML_ELEMENT_MESSAGE_ID:
                                message.Id = reader.ReadElementContentAsString();
                                break;
                            case MNSConstants.XML_ELEMENT_RECEIPT_HANDLE:
                                message.ReceiptHandle = reader.ReadElementContentAsString();
                                break;
                            case MNSConstants.XML_ELEMENT_MESSAGE_BODY_MD5:
                                message.BodyMD5 = reader.ReadElementContentAsString();
                                break;
                            case MNSConstants.XML_ELEMENT_MESSAGE_BODY:
                                message.Body = reader.ReadElementContentAsString();
                                break;
                            case MNSConstants.XML_ELEMENT_ENQUEUE_TIME:
                                message.EnqueueTime = AliyunSDKUtils.ConvertFromUnixEpochSeconds(reader.ReadElementContentAsLong());
                                break;
                            case MNSConstants.XML_ELEMENT_NEXT_VISIBLE_TIME:
                                message.NextVisibleTime = AliyunSDKUtils.ConvertFromUnixEpochSeconds(reader.ReadElementContentAsLong());
                                break;
                            case MNSConstants.XML_ELEMENT_FIRST_DEQUEUE_TIME:
                                message.FirstDequeueTime = AliyunSDKUtils.ConvertFromUnixEpochSeconds(reader.ReadElementContentAsLong());
                                break;
                            case MNSConstants.XML_ELEMENT_DEQUEUE_COUNT:
                                message.DequeueCount = (uint)reader.ReadElementContentAsInt();
                                break;
                            case MNSConstants.XML_ELEMENT_PRIORITY:
                                message.Priority = (uint)reader.ReadElementContentAsInt();
                                break;
                        }
                        break;
                    case System.Xml.XmlNodeType.EndElement:
                        if (reader.LocalName == MNSConstants.XML_ROOT_MESSAGE)
                        {
                            batchReceiveMessageResponse.Messages.Add(message);
                        }
                        break;
                }
            }
            reader.Close();
            return batchReceiveMessageResponse;
        }
开发者ID:a526757124,项目名称:YCTYProject,代码行数:56,代码来源:BatchReceiveMessageResponseUnmarshaller.cs


示例11: GetSummary

 /// <summary>
 /// Currently a naive implementation. Treats all fields under summary as text.
 /// </summary>
 /// <param name="xmlDocumentation"></param>
 /// <returns></returns>
 public string GetSummary(string xmlDocumentation)
 {
     var frag = new System.Xml.XmlTextReader(xmlDocumentation, System.Xml.XmlNodeType.Element, null);
     string result = "";
     while (frag.Read()) {
         result += frag.Value;
     }
     frag.Close();
     return result;
 }
开发者ID:flukus,项目名称:doCS,代码行数:15,代码来源:XmlDocumentationHelper.cs


示例12: ReadSettings

        /// <summary>
        /// loads a configuration from a xml-file - if there isn't one, use default settings
        /// </summary>
        public void ReadSettings()
        {
            bool dirty = false;
            Reset();
            try
            {
                System.Xml.XmlTextReader xmlConfigReader = new System.Xml.XmlTextReader("settings.xml");
                while (xmlConfigReader.Read())
                {
                    if (xmlConfigReader.NodeType == System.Xml.XmlNodeType.Element)
                    {
                        switch (xmlConfigReader.Name)
                        {
                            case "display":
                                fullscreen = Convert.ToBoolean(xmlConfigReader.GetAttribute("fullscreen"));
                                resolutionX = Convert.ToInt32(xmlConfigReader.GetAttribute("resolutionX"));
                                resolutionY = Convert.ToInt32(xmlConfigReader.GetAttribute("resolutionY"));

                                // validate resolution
                                // TODO
                              /*  if (!GraphicsAdapter.DefaultAdapter.SupportedDisplayModes.Any(x => x.Format == SurfaceFormat.Color &&
                                                                                                x.Height == resolutionY && x.Width == resolutionX))
                                {
                                    ChooseStandardResolution();
                                    dirty = true;
                                } */
                                break;
                        }
                    }
                }
                xmlConfigReader.Close();
            }
            catch
            {
                // error in xml document - write a new one with standard values
                try
                {
                    Reset();
                    dirty = true;
                }
                catch
                {
                }
            }

            // override fullscreen resolutions
            if (fullscreen)
            {
                ResolutionX = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Width;
                ResolutionY = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height;
            }

            if(dirty)
                Save();
        }
开发者ID:Jojendersie,项目名称:Voxelseeds,代码行数:58,代码来源:Settings.cs


示例13: Collection_Loaded

 private void Collection_Loaded(object sender, RoutedEventArgs e)
 {
     using (var stream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("a7DocumentDbStudio.Resources.avalonEditSql.xshd"))
     {
         using (var reader = new System.Xml.XmlTextReader(stream))
         {
             this.sqlEditor.SyntaxHighlighting =
                 ICSharpCode.AvalonEdit.Highlighting.Xshd.HighlightingLoader.Load(reader,
                 ICSharpCode.AvalonEdit.Highlighting.HighlightingManager.Instance);
         }
     }
 }
开发者ID:alekkowalczyk,项目名称:a7DocumentDbStudio,代码行数:12,代码来源:Collection.xaml.cs


示例14: TestADOTabularCSDLVisitor

        public void TestADOTabularCSDLVisitor()
        {
            ADOTabularConnection c = new ADOTabularConnection("Data Source=localhost", AdomdType.AnalysisServices);
            MetaDataVisitorCSDL v = new MetaDataVisitorCSDL(c);
            ADOTabularModel m = new ADOTabularModel(c, "Test","Test", "Test Description", "");
            System.Xml.XmlReader xr = new System.Xml.XmlTextReader(@"..\..\data\csdl.xml");
            var tabs = new ADOTabularTableCollection(c,m);

            v.GenerateTablesFromXmlReader(tabs, xr);

            Assert.AreEqual(4, tabs.Count);
            Assert.AreEqual(8, tabs["Sales"].Columns.Count());
        }
开发者ID:votrongdao,项目名称:DaxStudio,代码行数:13,代码来源:ADOTabularTests.cs


示例15: SettingsServer

        public SettingsServer(string profileFolderName, string profileDisplayName)
        {
            InitValues();

            ProfileFolderName = profileFolderName;
            ProfileDisplayName = profileDisplayName;

            try
            {
                if (!Directory.Exists(ProfileFolder))
                    Directory.CreateDirectory(ProfileFolder);

                foreach (string path in new string[] { ProfileFolder, StoreToFileFolder })
                {
                    try
                    {
                        if (!System.IO.Directory.Exists(path))
                            System.IO.Directory.CreateDirectory(path);
                    }
                    catch (System.Exception ex) { GenLib.Log.LogService.LogException("Unable to create folder: " + path + "\nError: ", ex); }
                }

                if (File.Exists(Path.Combine(ProfileFolder, SettingsFileName)))
                {
                    lock (lockObj)
                    {
                        using (System.Xml.XmlTextReader input = new System.Xml.XmlTextReader(Path.Combine(ProfileFolder, SettingsFileName)))
                        {
                            XmlSerializer serializer = new XmlSerializer(typeof(SettingsServer));
                            SettingsServer sett = (SettingsServer)serializer.Deserialize(input);
                            InitValues(sett);
                        }
                    }
                }
                else
                {
                    // since this is the first time we are loading this profile (settings don't exist yet)
                    // create a new version file so that we know what version of data is contained in this folder
                    WriteVersionData(ProfileFolder);
                    SaveSettings();
                }
            }
            catch (Exception ex) { GenLib.Log.LogService.LogException("Settings. LoadSettings failed.", ex); }

            try { File.Create(Path.Combine(ProfileFolder, "ProfileName-" + profileDisplayName + ".txt")); }		// try creating the filename containing the profile name
            catch	// if there are invalid chars then create a file and inside of it put the profile name
            {
                try { File.WriteAllText(Path.Combine(ProfileFolder, "ProfileName.txt"), profileDisplayName); }
                catch { }
            }
        }
开发者ID:AlertProject,项目名称:Text-processing-bundle,代码行数:51,代码来源:SettingsServer.cs


示例16: ReadConfig

        // Lecture de la configuration
        static void ReadConfig()
        {
            string config_file = "config.xml";
            if (!System.IO.File.Exists(config_file))
            {
                var newconf = new System.Xml.XmlTextWriter(config_file, null);
                newconf.WriteStartDocument();
                newconf.WriteStartElement("config");
                newconf.WriteElementString("last_update", "0");
                newconf.WriteElementString("auth_token", "");
                newconf.WriteEndElement();
                newconf.WriteEndDocument();
                newconf.Close();
            }

            var conf = new System.Xml.XmlTextReader(config_file);
            string CurrentElement = "";
            while (conf.Read())
            {
                switch(conf.NodeType) {
                    case System.Xml.XmlNodeType.Element:
                        CurrentElement = conf.Name;
                        break;
                    case System.Xml.XmlNodeType.Text:
                    if (CurrentElement == "last_update")
                        LastUpdate = DateTime.Parse(conf.Value);
                    if (CurrentElement == "auth_token")
                        AuthToken = conf.Value;
                        break;
                }
            }
            conf.Close();

            // On vérifie que le token est encore valide
            if (AuthToken.Length > 0)
            {
                var flickr = new Flickr(Program.ApiKey, Program.SharedSecret);
                try
                {
                    Auth auth = flickr.AuthCheckToken(AuthToken);
                    Username = auth.User.UserName;
                }
                catch (FlickrApiException ex)
                {
                    //MessageBox.Show(ex.Message, "Authentification requise",
                    //    MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    AuthToken = "";
                }
            }
        }
开发者ID:remyoudompheng,项目名称:flickrstats,代码行数:51,代码来源:Program.cs


示例17: AppSettings

        public AppSettings()
        {
            this.ProxySettings = new Proxy();
            this.PathSettings = new PathSetting();

            string proxySettingsFile = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\DichMusicHelperProxySettings.xml";
            string pathSettingsFile = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\DichMusicHelperPathSettings.xml";

            try
            {
                if (System.IO.File.Exists(proxySettingsFile))
                {
                    using (System.Xml.XmlTextReader reader = new System.Xml.XmlTextReader(proxySettingsFile))
                    {
                        while (reader.Read())
                        {
                            if (reader.Name == "ProxySettings")
                            {
                                this.ProxySettings.Server = reader[0];
                                this.ProxySettings.Port = reader[1];
                                this.ProxySettings.User = reader[2];
                                this.ProxySettings.Password = reader[3];
                                this.ProxySettings.UseProxy = Convert.ToBoolean(reader[4]);
                            }
                        }
                    }
                }

                if (System.IO.File.Exists(pathSettingsFile))
                {
                    using (System.Xml.XmlTextReader reader = new System.Xml.XmlTextReader(pathSettingsFile))
                    {
                        while (reader.Read())
                        {
                            if (reader.Name == "PathSettings")
                            {
                                this.PathSettings.Path = reader[0];
                                this.PathSettings.CreateFolder = Boolean.Parse(reader[1]);
                            }
                        }
                    }
                }
            }
            catch (Exception)
            {

            }
        }
开发者ID:kishtatik,项目名称:MusicFromVKWalls,代码行数:48,代码来源:AppSettings.cs


示例18: GetEvalListFromArgs

    public static List<ReturnsEval.DataSeriesEvaluator> GetEvalListFromArgs(string[] argsList_)
    {
      List<ReturnsEval.DataSeriesEvaluator> list = new List<ReturnsEval.DataSeriesEvaluator>();

      foreach (string s in argsList_)
      {
        if (System.IO.Directory.Exists(s))
        {
          foreach (string path in System.IO.Directory.GetFiles(s))
          {
            ReturnsEval.DataSeriesEvaluator ev = ReturnsEval.DataSeriesEvaluator.ReadFromDisk(path);
            if (ev != null) list.Add(ev);
            KeyValuePair<ConstructGen<double>, ReturnsEval.DataSeriesEvaluator> kvp = ExtensionMethods.ReadFromDisk<KeyValuePair<ConstructGen<double>, ReturnsEval.DataSeriesEvaluator>>(path);
            if (kvp.Value != null) list.Add(kvp.Value);
          }
        }
        else if (System.IO.File.Exists(s))
        {
          if (s.EndsWith(".xml"))
          {
            System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
            System.Xml.XmlTextReader reader = new System.Xml.XmlTextReader(string.Format(@"file://{0}", s.Replace(@"\", "/")));
            reader.MoveToContent();
            doc.Load(reader);
            reader.Close();
            foreach (System.Xml.XmlNode node in doc.DocumentElement.SelectNodes("BloombergTicker"))
            {
              DatedDataCollectionGen<double> hist = BbgTalk.HistoryRequester.GetHistory(new DateTime(2000, 1, 1), node.InnerText, "PX_LAST", true);
              DatedDataCollectionGen<double> genHist = new DatedDataCollectionGen<double>(hist.Dates, hist.Data).ToReturns();
              BbgTalk.RDResult nameData = BbgTalk.HistoryRequester.GetReferenceData(node.InnerText, "SHORT_NAME", null);
              ReturnsEval.DataSeriesEvaluator eval = new ReturnsEval.DataSeriesEvaluator(genHist.Dates, genHist.Data, nameData["SHORT_NAME"].GetValue<string>(), ReturnsEval.DataSeriesType.Returns);
              list.Add(eval);
            }
          }
          else
          {
            ReturnsEval.DataSeriesEvaluator ev = ReturnsEval.DataSeriesEvaluator.ReadFromDisk(s);
            if (ev != null) list.Add(ev);
            KeyValuePair<ConstructGen<double>, ReturnsEval.DataSeriesEvaluator> kvp = SI.ExtensionMethods.ReadFromDisk<KeyValuePair<ConstructGen<double>, ReturnsEval.DataSeriesEvaluator>>(s);
            if (kvp.Value != null) list.Add(kvp.Value);
          }
        }
      }

      return list;
    }
开发者ID:heimanhon,项目名称:researchwork,代码行数:46,代码来源:EvalComparerControl.cs


示例19: PhotoInfoLocationParseShortTest

        public void PhotoInfoLocationParseShortTest()
        {
            string x = "<photo id=\"7519320006\">"
                + "<location latitude=\"-23.32\" longitude=\"-34.2\" accuracy=\"10\" context=\"1\" />"
                + "</photo>";

            System.IO.StringReader sr = new System.IO.StringReader(x);
            System.Xml.XmlTextReader xr = new System.Xml.XmlTextReader(sr);
            xr.Read();

            var info = new PhotoInfo();
            ((IFlickrParsable)info).Load(xr);

            Assert.AreEqual("7519320006", info.PhotoId);
            Assert.IsNotNull(info.Location);
            Assert.AreEqual((GeoAccuracy)10, info.Location.Accuracy);
        }
开发者ID:JamieKitson,项目名称:flickrnet-experimental,代码行数:17,代码来源:PhotosGeoTests.cs


示例20: button1_Click

 private void button1_Click(object sender, EventArgs e)
 {
     System.IO.StreamReader sr = new System.IO.StreamReader(@"cars.xml");
     System.Xml.XmlTextReader xr = new System.Xml.XmlTextReader(sr);
     System.Xml.XmlDocument carCollectionDoc = new System.Xml.XmlDocument();
     carCollectionDoc.Load(xr);
     linkLabel1.Text = carCollectionDoc.InnerText;
     linkLabel2.Text = "First child node: " + carCollectionDoc.FirstChild.InnerText;
     linkLabel3.Text = "Second child node: " + carCollectionDoc.FirstChild.NextSibling.InnerText;
     System.Xml.XmlNode carcollection = carCollectionDoc.FirstChild.NextSibling;
     linkLabel4.Text = "Now that we have a reference to 'carcollection': " + carcollection.FirstChild.InnerText;
     linkLabel5.Text = "First child of collection: " + carcollection.FirstChild.InnerText;
     linkLabel6.Text = "First child of the first child of carcollection: " + carcollection.FirstChild.FirstChild.InnerText;
     System.Xml.XmlNodeList carCollectionItems = carCollectionDoc.SelectNodes("carcollection/car");
     System.Xml.XmlNode make = carCollectionItems.Item(0).SelectSingleNode("make");
     linkLabel7.Text = "make.InnerText: " + make.InnerText;
 }
开发者ID:kcehovski,项目名称:SQL,代码行数:17,代码来源:Form1.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Xml.XmlTextWriter类代码示例发布时间:2022-05-24
下一篇:
C# Xml.XmlDocument类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap