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


C# XmlReader.ReadStartElement方法代码示例

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


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

示例1: 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

示例2: ReadXml

        public void ReadXml(XmlReader reader)
        {
            reader.MoveToContent();

            Value = reader["Value"];

            if (reader.IsEmptyElement) {
                reader.ReadStartElement();
                return;
            }

            reader.ReadStartElement();
            while (!reader.EOF) {
                if (reader.IsStartElement()) {
                    switch (reader.Name) {
                        case "Animation":
                            XmlAnimationElement animation = new XmlAnimationElement();
                            animation.ReadXml(reader);
                            Animation = animation;
                            break;

                        default:
                            reader.Skip();
                            break;
                    }
                }
                else if (reader.NodeType == XmlNodeType.EndElement) {
                    reader.ReadEndElement();
                    break;
                }
                else
                    reader.Read();
            }
        }
开发者ID:jaquadro,项目名称:Amphibian,代码行数:34,代码来源:XmlDirectionElement.cs

示例3: 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

示例4: ReadXml

        public void ReadXml(XmlReader reader)
        {
            reader.MoveToContent();

            DefaultAnimation = reader["DefaultAnimation"];

            if (reader.IsEmptyElement) {
                reader.ReadStartElement();
                return;
            }

            reader.ReadStartElement();
            while (!reader.EOF) {
                if (reader.IsStartElement()) {
                    switch (reader.Name) {
                        case "Activity":
                            XmlActivityElement activity = new XmlActivityElement();
                            activity.ReadXml(reader);
                            Activities.Add(activity);
                            break;

                        default:
                            reader.Skip();
                            break;
                    }
                }
                else if (reader.NodeType == XmlNodeType.EndElement) {
                    reader.ReadEndElement();
                    break;
                }
                else
                    reader.Read();
            }
        }
开发者ID:jaquadro,项目名称:Amphibian,代码行数:34,代码来源:XmlActivityMapElement.cs

示例5: ReadXml

        public void ReadXml(XmlReader reader)
        {
            reader.MoveToContent();
            if (reader.IsEmptyElement) {
                reader.ReadStartElement();
                return;
            }

            reader.ReadStartElement();
            while (!reader.EOF) {
                if (reader.IsStartElement()) {
                    switch (reader.Name) {
                        case "Transform":
                            XmlTransformElement transform = new XmlTransformElement();
                            transform.ReadXml(reader);
                            Transform = transform;
                            break;

                        default:
                            reader.Skip();
                            break;
                    }
                }
                else if (reader.NodeType == XmlNodeType.EndElement) {
                    reader.ReadEndElement();
                    break;
                }
                else
                    reader.Read();
            }
        }
开发者ID:jaquadro,项目名称:Amphibian,代码行数:31,代码来源:XmlAnimatedSpriteInstance.cs

示例6: ClientData

        private ClientData(XmlReader reader)
        {
            reader.ReadStartElement("ClientData");

            for (int iter = 0; iter < _NumStoredValues; iter++) {

                reader.ReadStartElement(_StoredValueNames[iter]);

                if (_StoredValues[iter] is string)
                    _StoredValues[iter] = reader.ReadContentAsString();
                else if (_StoredValues[iter] is DateTime) {
                    string s = reader.ReadContentAsString();
                    long l = long.Parse(s, NumberStyles.HexNumber, CultureInfo.InvariantCulture);
                    _StoredValues[iter] = DateTime.FromFileTimeUtc(l);
                } else if (_StoredValues[iter] is bool) {
                    string s = reader.ReadContentAsString();
                    _StoredValues[iter] = !(string.IsNullOrEmpty(s) || s != "1");
                } else {
                    _StoredValues[iter] = ReadStringArray(reader);
                }
                reader.ReadEndElement();
            }

            reader.ReadEndElement();
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:25,代码来源:ClientData.cs

示例7: ReadXml

        public void ReadXml(XmlReader reader)
        {
            reader.MoveToContent();

            Source = reader["Source"];

            if (reader.IsEmptyElement) {
                reader.ReadStartElement();
                return;
            }

            reader.ReadStartElement();
            while (!reader.EOF) {
                if (reader.IsStartElement()) {
                    switch (reader.Name) {
                        case "Sprite":
                            XmlSpriteElement sprite = new XmlSpriteElement();
                            sprite.ReadXml(reader);
                            Sprites.Add(sprite);
                            break;

                        default:
                            reader.Skip();
                            break;
                    }
                }
                else if (reader.NodeType == XmlNodeType.EndElement) {
                    reader.ReadEndElement();
                    break;
                }
                else
                    reader.Read();
            }
        }
开发者ID:jaquadro,项目名称:Amphibian,代码行数:34,代码来源:XmlSpriteListElement.cs

示例8: ReadXml

        public void ReadXml(XmlReader reader)
        {
            reader.MoveToContent();

            Name = reader["Name"];

            if (reader.IsEmptyElement) {
                reader.ReadStartElement();
                return;
            }

            reader.ReadStartElement();
            while (!reader.EOF) {
                if (reader.IsStartElement()) {
                    switch (reader.Name) {
                        case "Directions":
                            ReadDirectionsXml(reader);
                            break;

                        default:
                            reader.Skip();
                            break;
                    }
                }
                else if (reader.NodeType == XmlNodeType.EndElement) {
                    reader.ReadEndElement();
                    break;
                }
                else
                    reader.Read();
            }
        }
开发者ID:jaquadro,项目名称:Amphibian,代码行数:32,代码来源:XmlAnimationSetElement.cs

示例9: ReadXml

 public void ReadXml(XmlReader reader)
 {
     if (reader.IsEmptyElement) return;
     reader.ReadStartElement("CommandCollection");
     reader.ReadStartElement("Commands");
     while(reader.NodeType != XmlNodeType.EndElement)
     {
         var c = new Command();
         switch(reader.Name)
         {
             case "AttackCommand":
                 _mutableSerializer = new XmlSerializer(typeof(AttackCommand));
                 c = (AttackCommand)_mutableSerializer.Deserialize(reader);
                 Commands.Add(c);
                 break;
             case "TimedCommand":
                 _mutableSerializer = new XmlSerializer(typeof(TimedCommand));
                 c = (TimedCommand)_mutableSerializer.Deserialize(reader);
                 Commands.Add(c);
                 break;
         }
     }
     reader.ReadEndElement();
     reader.ReadEndElement();
 }
开发者ID:arlenner,项目名称:EnterTheArena,代码行数:25,代码来源:CommandManager.cs

示例10: ReadXml

        public void ReadXml(XmlReader reader)
        {
            reader.MoveToContent();

            Repeat = Convert.ToInt32(reader["Repeat"], CultureInfo.InvariantCulture);

            if (reader.IsEmptyElement) {
                reader.ReadStartElement();
                return;
            }

            reader.ReadStartElement();
            while (!reader.EOF) {
                if (reader.IsStartElement()) {
                    switch (reader.Name) {
                        case "Frames":
                            ReadFramesXml(reader);
                            break;

                        default:
                            reader.Skip();
                            break;
                    }
                }
                else if (reader.NodeType == XmlNodeType.EndElement) {
                    reader.ReadEndElement();
                    break;
                }
                else
                    reader.Read();
            }
        }
开发者ID:jaquadro,项目名称:Amphibian,代码行数:32,代码来源:XmlAnimationElement.cs

示例11: Read

        /// <summary>
        /// 
        /// </summary>
        /// <param name="reader"></param>
        /// <param name="transactions"></param>
        internal static void Read(XmlReader reader, IList<TransactionSummary> transactions, bool preApproval)
        {

            transactions.Clear();

            if (reader.IsEmptyElement)
            {
                XMLParserUtils.SkipNode(reader);
            }

            if (preApproval == true)
                reader.ReadStartElement(TransactionSummaryListSerializer.PreApprovals);
            else
                reader.ReadStartElement(TransactionSummaryListSerializer.Transactions);
            reader.MoveToContent();

            while (!reader.EOF)
            {
                if (preApproval == true)
                {
                    if (XMLParserUtils.IsEndElement(reader, TransactionSummaryListSerializer.PreApprovals))
                    {
                        XMLParserUtils.SkipNode(reader);
                        break;
                    }
                }
                else
                {
                    if (XMLParserUtils.IsEndElement(reader, TransactionSummaryListSerializer.Transactions))
                    {
                        XMLParserUtils.SkipNode(reader);
                        break;
                    }
                }

                if (reader.NodeType == XmlNodeType.Element)
                {
                    TransactionSummary transaction = new TransactionSummary();
                    switch (reader.Name)
                    {
                        case TransactionSerializerHelper.Transaction:
                            TransactionSummarySerializer.Read(reader, transaction, preApproval);
                            transactions.Add(transaction);
                            break;
                        case TransactionSerializerHelper.PreApproval:
                            TransactionSummarySerializer.Read(reader, transaction, preApproval);
                            transactions.Add(transaction);
                            break;
                        default:
                            XMLParserUtils.SkipElement(reader);
                            break;
                    }
                }
                else
                {
                    XMLParserUtils.SkipNode(reader);
                }
            }
        }
开发者ID:Japle,项目名称:dotnet,代码行数:64,代码来源:TransactionSummaryListSerializer.cs

示例12: FromXml

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

            reader.ReadStartElement();

            Rounds = new List<Round>();
            if (reader.Name == "Rounds")
            {
                reader.ReadStartElement();

                Round round;
                while (reader.Name == "Round")
                {
                    round = new Round();
                    if (!round.FromXml(reader))
                    {
                        return false;
                    }
                    Rounds.Add(round);
                }

                if (reader.Name == "Rounds" && reader.NodeType == XmlNodeType.EndElement)
                {
                    reader.ReadEndElement();
                }
            }

            Items = new List<Item>();
            if (reader.Name == "Items")
            {
                reader.ReadStartElement();

                Item item;
                while (reader.Name == "Item")
                {
                    item = new Item();
                    if (!item.FromXml(reader))
                    {
                        return false;
                    }
                    Items.Add(item);
                }

                if (reader.Name == "Items" && reader.NodeType == XmlNodeType.EndElement)
                {
                    reader.ReadEndElement();
                }
            }

            if (reader.Name == "Node" && reader.NodeType == XmlNodeType.EndElement)
            {
                reader.ReadEndElement();
            }
            return true;
        }
开发者ID:burstas,项目名称:rmps,代码行数:59,代码来源:Node.cs

示例13: ReadXml

 public void ReadXml(XmlReader reader)
 {
     reader.ReadStartElement(typeof(infNFeSupl).Name);
     reader.ReadStartElement("qrCode");
     qrCode = reader.ReadString();
     reader.ReadEndElement();
     reader.ReadEndElement();
 }
开发者ID:luispelin,项目名称:Zeus.Net.NFe.NFCe,代码行数:8,代码来源:infNFeSupl.cs

示例14: ReadXml

 public override void ReadXml(XmlReader reader)
 {
     reader.ReadStartElement();
     reader.ReadStartElement("X");
     var x = reader.ReadContentAsDouble();
     reader.ReadEndElement();
     reader.ReadStartElement("Y");
     var y = reader.ReadContentAsDouble();
     reader.ReadEndElement();
     Value = new Point(x, y);
     reader.ReadEndElement();
 }
开发者ID:OronDF343,项目名称:Sky-Jukebox,代码行数:12,代码来源:PointProperty.cs

示例15: ReadXml

 public override void ReadXml(XmlReader reader)
 {
     var isEmptyElement = reader.IsEmptyElement;
     reader.ReadStartElement();
     if (!isEmptyElement)
     {
         reader.ReadStartElement("Format");
         Format = reader.ReadContentAsString();
         reader.ReadEndElement();
         OnlineResource.ReadXml(reader);
     }
 }
开发者ID:bertt,项目名称:BruTile,代码行数:12,代码来源:StyleSheetURL.cs


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