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


C# XmlReader.ReadElementString方法代码示例

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


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

示例1: ReadTokenCore

        protected override System.IdentityModel.Tokens.SecurityToken ReadTokenCore( XmlReader reader, SecurityTokenResolver tokenResolver )
        {
            if ( reader == null )
                throw new ArgumentNullException( "reader" );

            if ( reader.IsStartElement( Constants.UsernameTokenName, Constants.UsernameTokenNamespace ) )
            {
                //string id = reader.GetAttribute( Constants.IdAttributeName, Constants.WsUtilityNamespace );

                reader.ReadStartElement();

                // read the user name
                string userName = reader.ReadElementString( Constants.UsernameElementName, Constants.UsernameTokenNamespace );

                // read the password hash
                string password = reader.ReadElementString( Constants.PasswordElementName, Constants.UsernameTokenNamespace );

                // read nonce
                string nonce = reader.ReadElementString( Constants.NonceElementName, Constants.UsernameTokenNamespace );

                // read created
                string created = reader.ReadElementString( Constants.CreatedElementName, Constants.WsUtilityNamespace );

                reader.ReadEndElement();

                var info = new Info( userName, password );

                return new SecurityToken( info, nonce, created );
            }

            return DefaultInstance.ReadToken( reader, tokenResolver );
        }
开发者ID:Sn3b,项目名称:Omniture-API,代码行数:32,代码来源:SecurityTokenSerializer.cs

示例2: ReadXml

        public void ReadXml(XmlReader reader)
        {
            // Start to use the reader.
            reader.Read();
            // Read the first element ie root of this object
            reader.ReadStartElement("dictionary");

            // Read all elements
            while (reader.NodeType != XmlNodeType.EndElement)
            {
                // parsing the item
                reader.ReadStartElement("item");

                // PArsing the key and value
                string key = reader.ReadElementString("key");
                string value = reader.ReadElementString("value");

                // en reading the item.
                reader.ReadEndElement();
                reader.MoveToContent();

                // add the item
                Add(key, value);
            }

            // Extremely important to read the node to its end.
            // next call of the reader methods will crash if not called.
            reader.ReadEndElement();
        }
开发者ID:hiriumi,项目名称:EasyReporting,代码行数:29,代码来源:SerializableHashtable.cs

示例3: StatusElement

 /// <summary>
 /// Creates a new Status class using the XmlReade instance provided.
 /// </summary>
 /// <param name="reader">The XmlReader instance positioned at the Status node.</param>
 /// <param name="schemaVersion">The version of the schema that was used to validate.</param>
 public StatusElement(XmlReader reader, XacmlVersion schemaVersion)
     : base(XacmlSchema.Context, schemaVersion)
 {
     if (reader == null) throw new ArgumentNullException("reader");
     if (reader.LocalName != Consts.ContextSchema.StatusElement.Status) return;
     while (reader.Read())
     {
         switch (reader.LocalName)
         {
             case Consts.ContextSchema.StatusElement.StatusCode:
                 StatusCode = new StatusCodeElement(reader, schemaVersion);
                 break;
             case Consts.ContextSchema.StatusElement.StatusMessage:
                 _statusMessage = reader.ReadElementString();
                 break;
             case Consts.ContextSchema.StatusElement.StatusDetail:
                 _statusDetail = reader.ReadElementString();
                 break;
         }
         if (reader.LocalName == Consts.ContextSchema.StatusElement.Status &&
             reader.NodeType == XmlNodeType.EndElement)
         {
             break;
         }
     }
 }
开发者ID:mingkongbin,项目名称:anycmd,代码行数:31,代码来源:StatusElement.cs

示例4: ReadXml

        protected virtual void ReadXml(XmlReader reader, SyndicationFeed result)
        {
            if (result == null)
                throw new ArgumentNullException("result");
            else if (reader == null)
                throw new ArgumentNullException("reader");

            reader.ReadStartElement();              // Read in <RDF>
            reader.ReadStartElement("channel");     // Read in <channel>
            while (reader.IsStartElement())         // Process <channel> children
            {
                if (reader.IsStartElement("title"))
                    result.Title = new TextSyndicationContent(reader.ReadElementString());
                else if (reader.IsStartElement("link"))
                    result.Links.Add(new SyndicationLink(new Uri(reader.ReadElementString())));
                else if (reader.IsStartElement("description"))
                    result.Description = new TextSyndicationContent(reader.ReadElementString());
                else
                    reader.Skip();
            }
            reader.ReadEndElement();                // Read in </channel>

            while (reader.IsStartElement())
            {
                if (reader.IsStartElement("item"))
                {
                    result.Items = this.ReadItems(reader, result);

                    break;
                }
                else
                    reader.Skip();
            }
        }
开发者ID:iwaim,项目名称:growl-for-windows,代码行数:34,代码来源:Rss10FeedFormatter.cs

示例5: ReadTokenCore

        protected override SecurityToken ReadTokenCore(XmlReader reader, SecurityTokenResolver tokenResolver)
        {

            if (reader == null) throw new ArgumentNullException("reader");

            if (reader.IsStartElement(Constants.CreditCardTokenName, Constants.CreditCardTokenNamespace))
            {
                string id = reader.GetAttribute(Constants.Id, Constants.WsUtilityNamespace);

                reader.ReadStartElement();

                // read the credit card number
                string creditCardNumber = reader.ReadElementString(Constants.CreditCardNumberElementName, Constants.CreditCardTokenNamespace);

                // read the expiration date
                string expirationTimeString = reader.ReadElementString(Constants.CreditCardExpirationElementName, Constants.CreditCardTokenNamespace);
                DateTime expirationTime = XmlConvert.ToDateTime(expirationTimeString, XmlDateTimeSerializationMode.Utc);

                // read the issuer of the credit card
                string creditCardIssuer = reader.ReadElementString(Constants.CreditCardIssuerElementName, Constants.CreditCardTokenNamespace);
                reader.ReadEndElement();

                CreditCardInfo cardInfo = new CreditCardInfo(creditCardNumber, creditCardIssuer, expirationTime);

                return new CreditCardToken(cardInfo, id);
            }
            else
            {
                return WSSecurityTokenSerializer.DefaultInstance.ReadToken(reader, tokenResolver);
            }
        }
开发者ID:spzenk,项目名称:sfdocsamples,代码行数:31,代码来源:CreditCardSecurityTokenSerializer.cs

示例6: BulletPoint

 /** Constructor from xml file */
 public BulletPoint(XmlReader r)
 {
     r.ReadStartElement("BulletPoint");
     mName = r.ReadElementString("Name");
     mString = r.ReadElementString("String");
     mIsRegEx = XmlConvert.ToBoolean(r.ReadElementString("IsRegEx"));
     mWrapIsAtRight = XmlConvert.ToBoolean(r.ReadElementString("WrapIsAtRight"));
     r.ReadEndElement();
 }
开发者ID:kmunson,项目名称:CommentReflowerVSIX,代码行数:10,代码来源:BulletPoint.cs

示例7: BreakFlowString

 /** Constructor from xml file */
 public BreakFlowString(XmlReader r)
 {
     r.ReadStartElement("BreakFlowString");
     mName = r.ReadElementString("Name");
     mString = r.ReadElementString("String");
     mIsRegEx = XmlConvert.ToBoolean(r.ReadElementString("IsRegEx"));
     mNeverReflowLine = XmlConvert.ToBoolean(r.ReadElementString("NeverReflowLine"));
     mNeverReflowIntoNextLine = XmlConvert.ToBoolean(r.ReadElementString("NeverReflowIntoNextLine"));
     r.ReadEndElement();
 }
开发者ID:kmunson,项目名称:CommentReflowerVSIX,代码行数:11,代码来源:BreakFlowStrings.cs

示例8: MegaComment

 internal MegaComment(XmlReader rdr)
 {
     rdr.ReadStartElement("mega_comment");
     this.Id = rdr.ReadElementContentAsInt("id", "");
     this.Comment = rdr.ReadElementString("comment");
     this.User = rdr.ReadElementString("user");
     this.CreatedAt = rdr.ReadElementString("created_at").FromBatchBookFormat2();
     this.RecordId = int.Parse(rdr.ReadElementString("record_id"));
     rdr.ReadEndElement();
 }
开发者ID:batchblue,项目名称:batchbook-net,代码行数:10,代码来源:MegaComment.cs

示例9: Communication

 internal Communication(XmlReader rdr)
 {
     rdr.ReadStartElement("communication");
     this.Id = rdr.ReadElementContentAsInt("id", "");
     this.Subject = rdr.ReadElementString("subject");
     this.Body = rdr.ReadElementString("body");
     this.Date = rdr.ReadElementContentAsDateTime("date", "ctype");
     this.Ctype = rdr.ReadElementString("");
     this.Tags = Tag.BuildList(rdr);
     this.Comments = MegaComment.BuildList(rdr);
     this.CreateAt = rdr.ReadElementContentAsDateTime("created_at", "");
     this.UpdatedAt = rdr.ReadElementContentAsDateTime("updated_at", "");
     rdr.ReadEndElement();
 }
开发者ID:batchblue,项目名称:batchbook-net,代码行数:14,代码来源:Communication.cs

示例10: while

 /// <summary>
 /// Generates an object from its XML representation.
 /// </summary>
 /// <param name="reader">The <see cref="T:System.Xml.XmlReader"></see> stream from which the object is deserialized.</param>
 void IXmlSerializable.ReadXml(XmlReader reader)
 {
     reader.Read();
       reader.ReadStartElement("dictionary");
       while (reader.NodeType != XmlNodeType.EndElement) {
     reader.ReadStartElement("item");
     string key = reader.ReadElementString("key");
     string value = reader.ReadElementString("value");
     reader.ReadEndElement();
     reader.MoveToContent();
     this.Add(key, value);
       }
       reader.ReadEndElement();
 }
开发者ID:montyclift,项目名称:dashcommerce-3,代码行数:18,代码来源:ExtendedProperties.cs

示例11: Company

 internal Company(XmlReader rdr)
 {
     rdr.ReadStartElement("company");
     this.Id = rdr.ReadElementContentAsInt("id", "");
     this.Name = rdr.ReadElementString("name");
     this.Notes = rdr.ReadElementString("notes");
     //Skipping Images
     rdr.ReadToFollowing("tags");
     this.Tags = Tag.BuildList(rdr);
     this.Locations = Location.BuildList(rdr);
     this.Comments = MegaComment.BuildList(rdr);
     this.CreatedAt = rdr.ReadElementString("created_at").FromBatchBookFormat();
     this.UpdatedAt = rdr.ReadElementString("updated_at").FromBatchBookFormat();
     rdr.ReadEndElement();
 }
开发者ID:batchblue,项目名称:batchbook-net,代码行数:15,代码来源:Company.cs

示例12: ReadXml

 public void ReadXml(XmlReader reader)
 {
     int sequenceCount = 0;
       bool isEmpty = reader.IsEmptyElement;
       reader.ReadStartElement();
       if (isEmpty)
     return;
       while (reader.NodeType == XmlNodeType.Element)
       {
     if (sequenceCount == 0 || reader.IsStartElement("title"))
     {
       PitchSequences.Add(new PitchSequence());
       sequenceCount++;
     }
     if (reader.IsStartElement("title"))
       PitchSequences[sequenceCount - 1].Title = reader.ReadElementString();
     else if (reader.IsStartElement("pitch"))
     {
       var pitch = new Pitch();
       pitch.ReadXml(reader);
       PitchSequences[sequenceCount - 1].Pitches.Add(pitch);
     }
     else
       reader.ReadOuterXml();
       }
       reader.ReadEndElement();
 }
开发者ID:samgoat,项目名称:NC,代码行数:27,代码来源:Pitches.cs

示例13: ValidateVersion

		private static void ValidateVersion(XmlReader reader)
		{
			var version = reader.ReadElementString();

			if (version != VERSION)
				throw new ApplicationException("Version of serialize data isn't correct.", new SerializationException());
		}
开发者ID:lakshithagit,项目名称:Target-Process-Plugins,代码行数:7,代码来源:JsonBlobSerializer.cs

示例14: ReadXml

 public override void ReadXml(XmlReader reader)
 {
     reader.ReadStartElement("RemovePortCommand", Context.YttriumNamespace);
     base.ReadXml(reader);
     _isolate = bool.Parse(reader.ReadElementString("Isolate"));
     reader.ReadEndElement();
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:7,代码来源:RemovePortCommand.cs

示例15: PolicySetIdReferenceElementReadWrite

 /// <summary>
 /// Creates a policy set id reference using the XmlReader instance provided.
 /// </summary>
 /// <param name="reader">The XmlReader instance positioned at the "PolicySetIdReference" 
 /// node</param>
 /// <param name="schemaVersion">The version of the schema that will be used to validate.</param>
 public PolicySetIdReferenceElementReadWrite(XmlReader reader, XacmlVersion schemaVersion)
     : base(XacmlSchema.Policy, schemaVersion)
 {
     if (reader == null) throw new ArgumentNullException("reader");
     if (reader.LocalName == Consts.Schema1.PolicySetIdReferenceElement.PolicySetIdReference &&
         ValidateSchema(reader, schemaVersion))
     {
         if (reader.HasAttributes)
         {
             // Load all the attributes
             while (reader.MoveToNextAttribute())
             {
                 if (reader.LocalName == Consts.Schema2.PolicyReferenceElement.Version)
                 {
                     _version = reader.GetAttribute(Consts.Schema2.PolicyReferenceElement.Version);
                 }
                 else if (reader.LocalName == Consts.Schema2.PolicyReferenceElement.EarliestVersion)
                 {
                     _earliestVersion = reader.GetAttribute(Consts.Schema2.PolicyReferenceElement.EarliestVersion);
                 }
                 else if (reader.LocalName == Consts.Schema2.PolicyReferenceElement.LatestVersion)
                 {
                     _latestVersion = reader.GetAttribute(Consts.Schema2.PolicyReferenceElement.LatestVersion);
                 }
             }
             reader.MoveToElement();
         }
         _policySetIdReference = reader.ReadElementString();
     }
     else
     {
         throw new Exception(string.Format(Properties.Resource.exc_invalid_node_name, reader.LocalName));
     }
 }
开发者ID:mingkongbin,项目名称:anycmd,代码行数:40,代码来源:PolicySetIdReferenceElementReadWrite.cs


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