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


C# XmlReader.ReadString方法代码示例

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


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

示例1: ProcessXmlCore

 internal override void ProcessXmlCore (XmlReader reader)
 {
     switch (reader.Name) {
     case "name":
         name = reader.ReadString ();
         break;
     case "sort-name":
         sort_name = reader.ReadString ();
         break;
     case "disambiguation":
         disambiguation = reader.ReadString ();
         break;
     case "life-span":
         begin_date = reader ["begin"];
         end_date = reader ["end"];
         break;
     case "alias-list":
         if (reader.ReadToDescendant ("alias")) {
             List<string> aliases = new List<string> ();
             do aliases.Add (reader.ReadString ());
             while (reader.ReadToNextSibling ("alias"));
             this.aliases = aliases.AsReadOnly ();
         }
         break;
     default:
         base.ProcessXmlCore (reader);
         break;
     }
 }
开发者ID:androidhacker,项目名称:DotNetProjs,代码行数:29,代码来源:MusicBrainzEntity.cs

示例2: ReadXml

 public void ReadXml(XmlReader reader)
 {
     while (reader.Read())
     {
         if (reader.NodeType == XmlNodeType.Element)
         {
             if(reader.LocalName.Equals("Name"))
             {
                 Name = reader.ReadString();
             }
             else if(reader.LocalName.Equals("PlayerGender"))
             {
                 Gender = (Gender) Enum.Parse(typeof(Gender), reader.ReadString(), false);
             }
             else if(reader.LocalName.Equals("ShortDesc"))
             {
                 ShortDesc = reader.ReadString();
             }
             else if(reader.LocalName.Equals("Level"))
             {
                 Level = Convert.ToInt32(reader.ReadString());
             }
         }
     }
 }
开发者ID:lolindrath,项目名称:suroden,代码行数:25,代码来源:mob.cs

示例3: Site

 internal Site(XmlReader r)
 {
     while (r.Read())
     {
         if (r.NodeType == XmlNodeType.Element)
         {
             if (r.Name == "guid")
             {
                 string content = r.ReadString();
                 siteId = new Guid(content);
             }
             else if (r.Name == "name")
             {
                 string content = r.ReadString();
                 siteNickname = content;
             }
             else if (r.Name == "url")
             {
                 string content = r.ReadString();
                 targetUri = new Uri(content);
             }
             else if (r.Name == "plugin")
             {
                 string content = r.ReadString();
                 fetcherpluginName = content;
             }
             else if (r.Name == "layout")
             {
                 string content = r.ReadString();
                 layoutpluginName = content;
             }
         }
     }
 }
开发者ID:nnovic,项目名称:GetFacts,代码行数:34,代码来源:Site.cs

示例4: ReadXml

 public void ReadXml(XmlReader reader)
 {
     reader.MoveToContent();
     reader.ReadToDescendant("Value1");
     Value1 = reader.ReadString();
     reader.ReadEndElement();
     reader.ReadStartElement("Value2");
     Value2 = int.Parse(reader.ReadString());
     ReadXmlCalled = true;
 }
开发者ID:kimbirkelund,项目名称:SekhmetSerialization,代码行数:10,代码来源:XmlSerializableBar.cs

示例5: DeserializePropertyElement

        protected override void DeserializePropertyElement(XmlReader reader)
        {
            if (reader == null) throw new ArgumentNullException ("reader");

            if (reader.NamespaceURI == Schemas.DublinCoreSchema && reader.Name == "description") {
                Description = reader.ReadString ();
            } if (reader.NamespaceURI == Schemas.UpnpSchema && reader.Name == "longDescription") {
                LongDescription = reader.ReadString ();
            } else {
                base.DeserializePropertyElement (reader);
            }
        }
开发者ID:MustafaUzumcuCom,项目名称:mono-upnp,代码行数:12,代码来源:Genre.cs

示例6: Load

 internal static void Load(XmlReader x)
 {
     while (x.Read ()) {
         switch (x.LocalName) {
             case "UnittestCommand":
                 UnittestCommand = x.ReadString ();
                 break;
             case "MainMethodFlag":
                 MainMethodFlag = x.ReadString ();
                 break;
         }
     }
 }
开发者ID:Geod24,项目名称:Mono-D,代码行数:13,代码来源:UnittestSettings.cs

示例7: ReadFrom

		public ICustomXmlSerializer ReadFrom (XmlReader r)
		{
			while (r.Read ()) {
				switch (r.LocalName) {
					case "cmd":
						DubCommand = r.ReadString ();
						break;
					case "commonargs":
						CommonArgs = r.ReadString ();
						break;
				}
			}
			return this;
		}
开发者ID:DinrusGroup,项目名称:Mono-D,代码行数:14,代码来源:DubSettings.cs

示例8: Deserialize

        internal static XmlOnlineRecord Deserialize( XmlReader xmlReader, Version version )
        {
            if( xmlReader.NodeType != XmlNodeType.Element
                || xmlReader.Name != ElementName )
                throw new ApplicationException( "Needs an OnlineTransaction node to deserialize an online transaction object." );

            XmlOnlineRecord otrans = new XmlOnlineRecord();

            if( xmlReader.GetAttribute( "id" ) != null )
                otrans.Id = int.Parse( xmlReader.GetAttribute( "id" ) );
            if( xmlReader.GetAttribute( "lineItemId" ) != null )
                otrans.LineItemId = int.Parse( xmlReader.GetAttribute( "lineItemId" ) );
            if( xmlReader.GetAttribute( "source" ) != null )
                otrans.OnlineSource = xmlReader.GetAttribute( "source" );

            while( xmlReader.Read() )
            {
                switch( xmlReader.NodeType )
                {
                    case XmlNodeType.Element:
                        switch( xmlReader.Name.ToLower() )
                        {
                            case "source":
                                otrans.OnlineSource = xmlReader.ReadString();
                                break;
                            case "id":
                                otrans.Id = Int32.Parse( xmlReader.ReadString() );
                                break;
                            case "bankid":
                                otrans.BankId = xmlReader.ReadString();
                                break;
                            case "number":
                                otrans.Number = xmlReader.ReadString();
                                break;
                            case "date":
                                otrans.Date = DateTime.Parse( xmlReader.ReadString() );
                                break;
                            case "sequence":
                                otrans.Sequence = int.Parse( xmlReader.ReadString() );
                                break;
                            case "description":
                                otrans.Description = xmlReader.ReadString();
                                break;
                            case "amount":
                                otrans.Amount = Decimal.Parse( xmlReader.ReadString() );
                                break;
                            default:
                                break;
                        }
                        break;
                    case XmlNodeType.EndElement:
                        if( xmlReader.Name == ElementName )
                            return otrans;
                        break;
                }
            }

            return otrans;
        }
开发者ID:tkrehbiel,项目名称:UvMoney,代码行数:59,代码来源:XmlOnlineRecord.cs

示例9: ParseElement

		/// <summary>
		///		Parses the WDDX element and returns the deserialized
		///		content as a <see cref="System.String"/> object, advancing the reader to the next
		///		element.
		/// </summary>
		/// <param name="input">The pre-initialized <see cref="System.Xml.XmlTextReader"/> pointing to the WDDX to be parsed.</param>
		public object ParseElement(XmlReader input)
		{
			if (input.IsEmptyElement)
			{
				input.Skip();
				return String.Empty;
			}

			StringBuilder output = new StringBuilder();
			input.Read();
			
			while (!(input.Name == "string" && input.NodeType == XmlNodeType.EndElement))
			{
				if (input.NodeType == XmlNodeType.Text || input.NodeType == XmlNodeType.Whitespace)
				{
					output.Append(input.ReadString());
				}
				else if (input.Name == "char")
				{
					// parse out the <char code="xx"/> tag
					output.Append((char)Int32.Parse(input.GetAttribute("code"), NumberStyles.AllowHexSpecifier));
					input.Skip();
				}
			}

			input.ReadEndElement();

			return output.ToString();
		}
开发者ID:Bilal-S,项目名称:WDDX.net,代码行数:35,代码来源:StringDeserializer.cs

示例10: ReadObject

 public override object ReadObject(XmlReader reader)
 {
     SimpleEventRequest SimpleEventRequestField = null;
     if (IsParentStartElement(reader, false, true))
     {
         SimpleEventRequestField = new SimpleEventRequest();
         SimpleEventRequestField.AnyAttr = ReadAnyAttribute(reader);
         reader.Read();
         if (IsChildStartElement(reader, "Param", true, true))
         {
             reader.Read();
             string[] Param_List = reader.ReadString().Split();
             if ((this._CompressByteArrays 
                         || ((Param_List.Length == 1) 
                         && (Param_List[0].Length > 2))))
             {
                 SimpleEventRequestField.Param = Convert.FromBase64String(Param_List[0]);
             }
             else
             {
                 SimpleEventRequestField.Param = new byte[Param_List.Length];
                 for (int i = 0; (i < Param_List.Length); i = (i + 1))
                 {
                     SimpleEventRequestField.Param[i] = XmlConvert.ToByte(Param_List[i]);
                 }
             }
             reader.ReadEndElement();
         }
         SimpleEventRequestField.Any = ReadAnyElement(reader, false);
         reader.ReadEndElement();
     }
     return SimpleEventRequestField;
 }
开发者ID:koson,项目名称:.NETMF_for_LPC17xx,代码行数:33,代码来源:EventingService.cs

示例11: backgroundWorker1_DoWork

        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                xmlReader = new XmlTextReader(textBox1.Text);

                while (xmlReader.Read())
                {
                    if (xmlReader.NodeType == XmlNodeType.Element)
                    {
                        switch (xmlReader.Name)
                        {
                            case "title":
                                {
                                    Invoke((MethodInvoker)(() =>
                                    {
                                        checkedListBox1.Items.Add(xmlReader.ReadString());
                                    }));
                                    break;
                                }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
开发者ID:theaob,项目名称:RSS2ePub,代码行数:29,代码来源:Form1.cs

示例12: ReadXml

 public void ReadXml(XmlReader reader)
 {
     reader.ReadStartElement("PropertyName");
     PropertyName = reader.ReadString();
     reader.ReadEndElement();
     if (!reader.IsEmptyElement)
     {
         reader.ReadStartElement("PropertyValue");
         PropertyValue = reader.ReadString();
         reader.ReadEndElement();
     }
     else
     {
         reader.Read();
     }
 }
开发者ID:biganth,项目名称:Curt,代码行数:16,代码来源:LogDetailInfo.cs

示例13: DeserializePropertyElement

        protected override void DeserializePropertyElement(XmlReader reader)
        {
            if (reader == null) throw new ArgumentNullException ("reader");

            if (reader.NamespaceURI == Schemas.UpnpSchema) {
                if (reader.Name == "genre") {
                    genre_list.Add (reader.ReadString ());
                } else if (reader.Name == "artistDiscographyURI") {
                    ArtistDiscographyUri = new Uri (reader.ReadString ());
                } else {
                    base.DeserializePropertyElement (reader);
                }
            } else {
                base.DeserializePropertyElement (reader);
            }
        }
开发者ID:MustafaUzumcuCom,项目名称:mono-upnp,代码行数:16,代码来源:MusicArtist.cs

示例14: DeserializePropertyElement

        protected override void DeserializePropertyElement(XmlReader reader)
        {
            if (reader == null) throw new ArgumentNullException ("reader");

            if (reader.NamespaceURI == Schemas.UpnpSchema) {
                switch (reader.LocalName) {
                case "region":
                    Region = reader.ReadString ();
                 	break;
                case "radioCallSign":
                    RadioCallSign = reader.ReadString ();
                    break;
                case "radioStationID":
                    RadioStationId = reader.ReadString ();
                    break;
                case "radioBand":
                    RadioBand = reader.ReadString ();
                    break;
                case "channelNr":
                    ChannelNr = reader.ReadContentAsInt ();
                    break;
                default:
                    base.DeserializePropertyElement (reader);
                    break;
                }
            } else {
                base.DeserializePropertyElement (reader);
            }
        }
开发者ID:MustafaUzumcuCom,项目名称:mono-upnp,代码行数:29,代码来源:AudioBroadcast.cs

示例15: ReadObject

 public override object ReadObject(XmlReader reader)
 {
     OneWayAttachmentRequest OneWayAttachmentRequestField = null;
     if (IsParentStartElement(reader, false, true))
     {
         OneWayAttachmentRequestField = new OneWayAttachmentRequest();
         OneWayAttachmentRequestField.AnyAttr = ReadAnyAttribute(reader);
         reader.Read();
         if (IsChildStartElement(reader, "Param", true, true))
         {
             reader.Read();
             if (IsAttribute(reader, "href"))
             {
                 string contentID;
                 contentID = reader.Value;
                 reader.MoveToElement();
                 reader.ReadStartElement("Include", "http://www.w3.org/2004/08/xop/include");
                 reader.ReadEndElement();
                 OneWayAttachmentRequestField.Param = GetBodyPartContent(contentID, BodyParts);
             }
             else
             {
                 OneWayAttachmentRequestField.Param = Convert.FromBase64String(reader.ReadString());
                 reader.ReadEndElement();
             }
         }
         OneWayAttachmentRequestField.Any = ReadAnyElement(reader, false);
         reader.ReadEndElement();
     }
     return OneWayAttachmentRequestField;
 }
开发者ID:koson,项目名称:.NETMF_for_LPC17xx,代码行数:31,代码来源:AttachmentService.cs


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