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


C# XmlReader.ReadElementContentAsInt方法代码示例

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


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

示例1: readItems

		private void readItems(XmlReader reader) {
			reader.ReadToFollowing ("ItemDatabase");
			bool continueReading = reader.ReadToDescendant ("Item");

			while (continueReading) {
				//Read all information from the .xml-file
				reader.ReadToDescendant ("Id");
				int id = reader.ReadElementContentAsInt ();
				reader.ReadToNextSibling ("Name");
				string name = reader.ReadElementContentAsString ();
				reader.ReadToNextSibling ("Description");
				string desc = reader.ReadElementContentAsString ();
				reader.ReadToNextSibling ("Value");
				int value = reader.ReadElementContentAsInt ();
				reader.ReadToNextSibling ("Type");
				string type = reader.ReadElementContentAsString ();
				ItemType t = type.StringToType ();

				//And add the item to the database
				Item i = new Item (name, desc, value, t, id);

				//check for attributes and add them to the item
				checkForAttributes(reader, i);

				//Add the item to the databse and read end element
				items.Add(i);
				reader.ReadEndElement ();
				//Check if there is another item to read
				continueReading = reader.ReadToNextSibling ("Item");
			}
		}
开发者ID:TobiasMorell,项目名称:Game2Grow-Wizard,代码行数:31,代码来源:ItemDatabase.cs

示例2: while

 void IFlickrParsable.Load(XmlReader reader)
 {
     reader.Read();
       while (reader.LocalName != "photos")
       {
     switch (reader.LocalName)
     {
       case "firstdatetaken":
     this.FirstTakenDate = UtilityMethods.ParseDateWithGranularity(reader.ReadElementContentAsString());
     continue;
       case "firstdate":
     this.FirstDate = UtilityMethods.UnixTimestampToDate(reader.ReadElementContentAsString());
     continue;
       case "count":
     this.PhotoCount = reader.ReadElementContentAsInt();
     continue;
       case "views":
     this.Views = reader.ReadElementContentAsInt();
     continue;
       default:
     reader.Skip();
     continue;
     }
       }
       reader.Read();
 }
开发者ID:rmck,项目名称:FlickrNet,代码行数:26,代码来源:PersonPhotosSummary.cs

示例3: ReadXml

 public void ReadXml(XmlReader reader)
 {
     while (reader.Read())
     {
         if (reader.NodeType == XmlNodeType.EndElement)
         {
             break;
         }
         if (reader.NodeType == XmlNodeType.Whitespace)
         {
             continue;
         }
         switch (reader.Name)
         {
             case "portalID":
                 PortalID = reader.ReadElementContentAsInt();
                 break;
             case "portalAliasID":
                 PortalAliasID = reader.ReadElementContentAsInt();
                 break;
             case "HTTPAlias":
                 HTTPAlias = reader.ReadElementContentAsString();
                 break;
         }
     }
 }
开发者ID:biganth,项目名称:Curt,代码行数:26,代码来源:PortalAliasInfo.cs

示例4: Read

        internal static void Read(XmlReader reader, TransactionSearchResult result)
        {
            if (reader == null)
                throw new ArgumentNullException("reader");
            if (result == null)
                throw new ArgumentNullException("result");

            if (reader.IsEmptyElement)
            {
                SerializationHelper.SkipNode(reader);
                return;
            }

            reader.ReadStartElement(TransactionSearchResultSerializer.TransactionSearchResult);
            reader.MoveToContent();

            while (!reader.EOF)
            {
                if (SerializationHelper.IsEndElement(reader, TransactionSearchResultSerializer.TransactionSearchResult))
                {
                    SerializationHelper.SkipNode(reader);
                    break;
                }

                if (reader.NodeType == XmlNodeType.Element)
                {
                    switch (reader.Name)
                    {
                        case TransactionSearchResultSerializer.Date:
                            result.Date = reader.ReadElementContentAsDateTime();
                            break;
                        case TransactionSearchResultSerializer.CurrentPage:
                            result.CurrentPage = reader.ReadElementContentAsInt();
                            break;
                        case TransactionSearchResultSerializer.TotalPages:
                            result.TotalPages = reader.ReadElementContentAsInt();
                            break;
                        case TransactionSummaryListSerializer.Transactions:
                            TransactionSummaryListSerializer.Read(reader, result.Items);
                            break;
                        default:
                            SerializationHelper.SkipElement(reader);
                            break;
                    }
                }
                else
                {
                    SerializationHelper.SkipNode(reader);
                }
            }
        }
开发者ID:rubiosevero,项目名称:ProjetoBHS_SVOT_3Camadas,代码行数:51,代码来源:TransactionSearchResultSerializer.cs

示例5: ReadXml

        public void ReadXml(XmlReader reader)
        {
            if (reader.LocalName != "icon" && !reader.ReadToDescendant("icon"))
                throw new InvalidDataException();

            XmlHelper.ParseXml(reader, new XmlParseSet
            {
                {"url", () => this.RelativeUrl = reader.ReadString()},
                {"mimetype", () => this.MimeType = reader.ReadString()},
                {"width", () => this.Width = reader.ReadElementContentAsInt()},
                {"height", () => this.Height = reader.ReadElementContentAsInt()},
                {"depth", () => this.Depth = reader.ReadElementContentAsInt()}
            });
        }
开发者ID:kthompson,项目名称:Upnp,代码行数:14,代码来源:UpnpIcon.cs

示例6: Read

        /// <summary>
        /// 
        /// </summary>
        /// <param name="reader"></param>
        /// <param name="result"></param>
        internal static void Read(XmlReader reader, PreApprovalSearchResult result)
        {
            if (reader.IsEmptyElement)
            {
                XMLParserUtils.SkipNode(reader);
                return;
            }

            reader.ReadStartElement(PreApprovalSearchResultSerializer.PreApprovalSearchResult);

            reader.MoveToContent();

            while (!reader.EOF)
            {

                if (XMLParserUtils.IsEndElement(reader, PreApprovalSearchResultSerializer.PreApprovalSearchResult))
                {
                    XMLParserUtils.SkipNode(reader);
                    break;
                }

                if (reader.NodeType == XmlNodeType.Element)
                {
                    switch (reader.Name)
                    {
                        case PreApprovalSearchResultSerializer.Date:
                            result.Date = reader.ReadElementContentAsDateTime();
                            break;
                        case PreApprovalSearchResultSerializer.CurrentPage:
                            result.CurrentPage = reader.ReadElementContentAsInt();
                            break;
                        case PreApprovalSearchResultSerializer.TotalPages:
                            result.TotalPages = reader.ReadElementContentAsInt();
                            break;
                        case PreApprovalSummaryListSerializer.PreApprovals:
                            PreApprovalSummaryListSerializer.Read(reader, result.PreApprovals);
                            break;
                        default:
                            XMLParserUtils.SkipElement(reader);
                            break;
                    }
                }
                else
                {
                    XMLParserUtils.SkipNode(reader);
                }
            }
        }
开发者ID:couras,项目名称:dotnet,代码行数:53,代码来源:PreApprovalSearchResultSerializer.cs

示例7: ParseXml

        internal static MarketplaceAppImageNode ParseXml(XmlReader reader)
        {
            var node = new MarketplaceAppImageNode();

            reader.ReadStartElement();

            while (reader.NodeType != XmlNodeType.EndElement)
            {
                switch (reader.LocalName)
                {
                    case "id":
                        node.Id = reader.ReadElementContentAsUrn();
                        break;

                    case "orientation":
                        node.Orientation = reader.ReadElementContentAsInt();
                        break;

                    default:
                        reader.Skip();
                        break;
                }
            }

            reader.ReadEndElement();

            return node;
        }
开发者ID:rikkit,项目名称:Cimbalino-Phone-Toolkit,代码行数:28,代码来源:MarketplaceAppImageNode.cs

示例8: ParseXml

        internal static WindowsPhoneStoreServiceAppImageNode ParseXml(XmlReader reader)
        {
            var node = new WindowsPhoneStoreServiceAppImageNode();

            if (reader.IsEmptyElement)
            {
                reader.Skip();
            }
            else
            {
                reader.ReadStartElement();

                while (reader.NodeType != XmlNodeType.EndElement)
                {
                    switch (reader.LocalName)
                    {
                        case "id":
                            node.Id = reader.ReadElementContentAsUrn();
                            break;

                        case "orientation":
                            node.Orientation = reader.ReadElementContentAsInt();
                            break;

                        default:
                            reader.Skip();
                            break;
                    }
                }

                reader.ReadEndElement();
            }

            return node;
        }
开发者ID:HimanshPal,项目名称:Cimbalino-Toolkit,代码行数:35,代码来源:WindowsPhoneStoreServiceAppImageNode.cs

示例9: FromXml

        public bool FromXml(XmlReader reader)
        {
            if (reader == null || reader.Name != "Lib")
            {
                return false;
            }

            if (reader.Name == "Order" || reader.ReadToDescendant("Order"))
            {
                Order = reader.ReadElementContentAsInt();
            }
            if (reader.Name == "Id" || reader.ReadToNextSibling("Id"))
            {
                Id = reader.ReadElementContentAsString();
            }
            if (reader.Name == "Name" || reader.ReadToNextSibling("Name"))
            {
                Name = reader.ReadElementContentAsString();
            }
            if (reader.Name == "Text" || reader.ReadToNextSibling("Text"))
            {
                Text = reader.ReadElementContentAsString();
            }
            if (reader.Name == "Memo" || reader.ReadToNextSibling("Memo"))
            {
                Memo = reader.ReadElementContentAsString();
            }
            return true;
        }
开发者ID:burstas,项目名称:rmps,代码行数:29,代码来源:LibHeader.cs

示例10: while

 void IFlickrParsable.Load(XmlReader reader)
 {
     while (reader.NodeType != XmlNodeType.EndElement)
       {
     switch (reader.LocalName)
     {
       case "count":
     this.Count = reader.ReadElementContentAsInt();
     continue;
       case "prevphoto":
     this.PreviousPhoto = new ContextPhoto();
     this.PreviousPhoto.Load(reader);
     if (this.PreviousPhoto.PhotoId == "0")
     {
       this.PreviousPhoto = (ContextPhoto) null;
       continue;
     }
     else
       continue;
       case "nextphoto":
     this.NextPhoto = new ContextPhoto();
     this.NextPhoto.Load(reader);
     if (this.NextPhoto.PhotoId == "0")
     {
       this.NextPhoto = (ContextPhoto) null;
       continue;
     }
     else
       continue;
       default:
     continue;
     }
       }
 }
开发者ID:rmck,项目名称:FlickrNet,代码行数:34,代码来源:Context.cs

示例11: FromXml

        public bool FromXml(XmlReader reader)
        {
            if (reader == null || reader.Name != "Ren" || !reader.IsStartElement())
            {
                return false;
            }

            if (reader.Name == "Order" || reader.ReadToDescendant("Order"))
            {
                Order = reader.ReadElementContentAsInt();
            }
            if (reader.Name == "Id" || reader.ReadToNextSibling("Id"))
            {
                Id = reader.ReadElementContentAsString();
            }
            if (reader.Name == "Name" || reader.ReadToNextSibling("Name"))
            {
                Name = reader.ReadElementContentAsString();
            }
            if (reader.Name == "Command" || reader.ReadToNextSibling("Command"))
            {
                Command = reader.ReadElementContentAsString();
            }
            if (reader.Name == "Remark" || reader.ReadToNextSibling("Remark"))
            {
                Remark = reader.ReadElementContentAsString();
            }
            if (reader.Name == "Ren" && reader.NodeType == XmlNodeType.EndElement)
            {
                reader.ReadEndElement();
            }
            return true;
        }
开发者ID:burstas,项目名称:rmps,代码行数:33,代码来源:MRen.cs

示例12: ReadAreaType

        public static AreaType ReadAreaType(XmlReader reader, Counter<string> badTags)
        {
            string type = null;
            int level = 0;
            while (reader.Read())
            {
                if (reader.NodeType == XmlNodeType.Element && reader.Name == "type")
                {
                    type = reader.ReadElementContentAsString();
                }
                else if (reader.NodeType == XmlNodeType.Element && reader.Name == "level")
                {
                    level = reader.ReadElementContentAsInt();
                }
                else if (reader.NodeType == XmlNodeType.Element)
                {
                    badTags.Increment(reader.Name);
                }
                else if (reader.NodeType == XmlNodeType.EndElement && reader.Name == "area")
                {
                    break;
                }
            }

            if (level == 0 || type == null)
                throw new Exception("Area type or level not specified.");
            return new AreaType(level, type);
        }
开发者ID:jennstubley,项目名称:rpg-game,代码行数:28,代码来源:XmlHelper.cs

示例13: ParseXml

        internal static WindowsStoreServiceAppCategoryNode ParseXml(XmlReader reader)
        {
            var node = new WindowsStoreServiceAppCategoryNode();

            reader.ReadStartElement();

            while (reader.NodeType != XmlNodeType.EndElement)
            {
                switch (reader.Name)
                {
                    case "I":
                        node.Id = reader.ReadElementContentAsInt();
                        break;

                    case "N":
                        node.Name = reader.ReadElementContentAsString();
                        break;

                    default:
                        reader.Skip();
                        break;
                }
            }

            reader.ReadEndElement();

            return node;
        }
开发者ID:HimanshPal,项目名称:Cimbalino-Toolkit,代码行数:28,代码来源:WindowsStoreServiceAppCategoryNode.cs

示例14: Read

        internal static void Read(XmlReader reader, PaymentMethod paymentMethod)
        {
            if (reader == null)
                throw new ArgumentNullException("reader");
            if (paymentMethod == null)
                throw new ArgumentNullException("paymentMethod");

            if (reader.IsEmptyElement)
            {
                SerializationHelper.SkipNode(reader);
                return;
            }

            reader.ReadStartElement(PaymentMethodSerializer.PaymentMethod);
            reader.MoveToContent();

            while (!reader.EOF)
            {
                if (SerializationHelper.IsEndElement(reader, PaymentMethodSerializer.PaymentMethod))
                {
                    SerializationHelper.SkipNode(reader);
                    break;
                }

                if (reader.NodeType == XmlNodeType.Element)
                {
                    switch (reader.Name)
                    {
                        case PaymentMethodSerializer.PaymentMethodType:
                            paymentMethod.PaymentMethodType = reader.ReadElementContentAsInt();
                            break;
                        case PaymentMethodSerializer.PaymentMethodCode:
                            paymentMethod.PaymentMethodCode = reader.ReadElementContentAsInt();
                            break;
                        default:
                            SerializationHelper.SkipElement(reader);
                            break;
                    }
                }
                else
                {
                    SerializationHelper.SkipNode(reader);
                }
            }
        }
开发者ID:rubiosevero,项目名称:ProjetoBHS_SVOT_3Camadas,代码行数:45,代码来源:PaymentMethodSerializer.cs

示例15: Read

        internal static void Read(XmlReader reader, Item item)
        {
            if (reader == null)
                throw new ArgumentNullException("reader");
            if (item == null)
                throw new ArgumentNullException("item");

            if (reader.IsEmptyElement)
            {
                SerializationHelper.SkipNode(reader);
                return;
            }

            reader.ReadStartElement(ItemSerializer.Item);
            reader.MoveToContent();

            while (!reader.EOF)
            {
                if (SerializationHelper.IsEndElement(reader, ItemSerializer.Item))
                {
                    SerializationHelper.SkipNode(reader);
                    break;
                }

                if (reader.NodeType == XmlNodeType.Element)
                {
                    switch (reader.Name)
                    {
                        case ItemSerializer.Id:
                            item.Id = reader.ReadElementContentAsString();
                            break;
                        case ItemSerializer.Description:
                            item.Description = reader.ReadElementContentAsString();
                            break;
                        case ItemSerializer.Quantity:
                            item.Quantity = reader.ReadElementContentAsInt();
                            break;
                        case ItemSerializer.Amount:
                            item.Amount = reader.ReadElementContentAsDecimal();
                            break;
                        case ItemSerializer.Weight:
                            item.Weight = reader.ReadElementContentAsLong();
                            break;
                        case ItemSerializer.ShippingCost:
                            item.ShippingCost = reader.ReadElementContentAsDecimal();
                            break;
                        default:
                            SerializationHelper.SkipElement(reader);
                            break;
                    }
                }
                else
                {
                    SerializationHelper.SkipNode(reader);
                }
            }
        }
开发者ID:rubiosevero,项目名称:ProjetoBHS_SVOT_3Camadas,代码行数:57,代码来源:ItemSerializer.cs


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