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


C# XmlReader.ReadElementContentAsString方法代码示例

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


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

示例1: ReadXml

 public void ReadXml(XmlReader reader)
 {
     while (!reader.EOF)
     {
         if (reader.IsStartElement())
         {
             switch (reader.Name)
             {
                 case ModeElementName:
                     TranslitModeEnum mode;
                     string elementContent = reader.ReadElementContentAsString();
                     if (!Enum.TryParse(elementContent, true, out mode))
                     {
                         throw new InvalidDataException(string.Format("Invalit ignore Title value read: {0}",elementContent));
                     }
                     Mode = mode;
                     continue;
                 case FileNameElementName:
                     FileName = reader.ReadElementContentAsString();
                     continue;
             }
         }
         reader.Read();
     }
 }
开发者ID:rajeshwarn,项目名称:fb2converters,代码行数:25,代码来源:TransliterationSettingsImp.cs

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

示例3: FromXml

        public bool FromXml(XmlReader reader)
        {
            if (reader == null || reader.Name != "Udc")
            {
                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 == "Tips" || reader.ReadToNextSibling("Tips"))
            {
                Tips = reader.ReadElementContentAsString();
            }
            if (reader.Name == "Data" || reader.ReadToNextSibling("Data"))
            {
                Data = reader.ReadElementContentAsString();
            }
            if (reader.Name == "Memo" || reader.ReadToNextSibling("Memo"))
            {
                Data = reader.ReadElementContentAsString();
            }
            return true;
        }
开发者ID:burstas,项目名称:rmps,代码行数:33,代码来源:Udc.cs

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

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

示例6: ReadXml

        public override void ReadXml(XmlReader reader)
        {
            if (CheckEmptyNode(reader, "ContactPersonPrimary", Namespace))
                return;

            while (!reader.EOF)
            {
                if (reader.IsStartElement())
                {
                    var isEmpty = reader.IsEmptyElement;
                    switch (reader.LocalName)
                    {
                        case "ContactPerson":
                            ContactPerson = isEmpty ? string.Empty : reader.ReadElementContentAsString();
                            break;
                        case "ContactOrganization":
                            ContactOrganization = isEmpty ? string.Empty : reader.ReadElementContentAsString();
                            break;

                        default:
                            reader.Skip();
                            break;
                    }
                }
                else if (reader.NodeType == XmlNodeType.EndElement)
                {
                    reader.ReadEndElement();
                    return;
                }
                else
                {
                    reader.Read();
                }
            }
        }
开发者ID:bertt,项目名称:BruTile,代码行数:35,代码来源:ContactPersonPrimary.cs

示例7: _getHeadersFromEntry

 private static string _getHeadersFromEntry(XmlReader oEntry)
 {
     StringBuilder builder = new StringBuilder();
     while (oEntry.Read())
     {
         string str;
         if ((oEntry.NodeType == XmlNodeType.Element) && ((str = oEntry.Name) != null))
         {
             if (!(str == "name"))
             {
                 if (str == "value")
                 {
                     goto Label_0052;
                 }
             }
             else
             {
                 builder.Append(oEntry.ReadElementContentAsString());
                 builder.Append(": ");
             }
         }
         continue;
     Label_0052:
         builder.Append(oEntry.ReadElementContentAsString());
         builder.Append("\r\n");
     }
     return builder.ToString();
 }
开发者ID:Domer79,项目名称:CIAPI.CS,代码行数:28,代码来源:HTTPArchiveXML.cs

示例8: ParseXml

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

            reader.ReadStartElement();

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

                    case "string":
                        node.Title = reader.ReadElementContentAsString();
                        break;

                    case "disclosure":
                        node.Disclosure = reader.ReadElementContentAsString();
                        break;

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

            reader.ReadEndElement();

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

示例9: CreateBeatFromXmlSubtree

        /// <summary>
        /// Reads an Xml Subtree and looks for a Node with the name "Location" and "Mood"
        /// If both nodes are found then a Beat object is created and added to the m_BeatsList
        /// </summary>
        /// <param name="Subtree">The XML subtree to Read</param>
        private void CreateBeatFromXmlSubtree(XmlReader Subtree)
        {
            string Location = "";
            string MoodString = "";

            while (Subtree.Read())
            {
                if (Subtree.NodeType == XmlNodeType.Element)
                {
                    switch(Subtree.Name)
                    {
                        case "Location":
                            Location = Subtree.ReadElementContentAsString();
                            break;
                        case "Mood":
                             MoodString = Subtree.ReadElementContentAsString();
                            break;
                    }
                }
            }

            //Ensure both values have been set
            if (Location != "" && MoodString != "")
            {
                m_BeatsList.Add(new Beat(Location, ParseMood(MoodString)));
            }
        }
开发者ID:AndyKelly,项目名称:Heartbeats,代码行数:32,代码来源:XmlParser.cs

示例10: ParseXml

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

            reader.ReadStartElement();

            while (reader.NodeType != XmlNodeType.EndElement)
            {
                switch (reader.Name)
                {
                    case "U":
                        node.Url = reader.ReadElementContentAsString();
                        break;

                    case "Cap":
                        node.Caption = reader.ReadElementContentAsString();
                        break;

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

            reader.ReadEndElement();

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

示例11: Searchers

        public Searchers(XmlReader reader)
        {
            this.Choices = new List<Choice>();
            this.CurrentSearch = "";

            reader.Read();
            if (reader.Name != "TheSearchers")
                return; // bail out

            reader.Read();
            while (!reader.EOF)
            {
                if ((reader.Name == "TheSearchers") && !reader.IsStartElement())
                    break; // all done

                if (reader.Name == "Current")
                    this.CurrentSearch = reader.ReadElementContentAsString();
                else if (reader.Name == "Choice")
                {
                    string url = reader.GetAttribute("URL");
                    if (url == null)
                        url = reader.GetAttribute("URL2");
                    else
                    {
                        // old-style URL, replace "!" with "{ShowName}+{Season}+{Episode}"
                        url = url.Replace("!", "{ShowName}+{Season}+{Episode}");
                    }
                    this.Add(reader.GetAttribute("Name"), url);
                    reader.ReadElementContentAsString();
                }
                else
                    reader.ReadOuterXml();
            }
        }
开发者ID:madams74,项目名称:tvrename,代码行数:34,代码来源:Searchers.cs

示例12: ParseItems

        /// <summary>
        /// Parse the results of the Bing search
        /// </summary>
        /// <param name="reader">The xml reader containing the search results</param>
        public Collection<Article> ParseItems(XmlReader reader, Feed ownerFeed)
        {
            Collection<Article> results = new Collection<Article>();
            reader.ReadToFollowing("item");
            do
            {
                if (reader.ReadToFollowing("title"))
                {
                    string name = reader.ReadElementContentAsString();

                    if (reader.ReadToFollowing("link"))
                    {
                        string uri = reader.ReadElementContentAsString();

                        // Assign feed information to Article object.
                        Article newResult = new Article
                        {
                            ArticleTitle = name,
                            ArticleBaseURI = uri
                        };
                        // Safely add the search result to the collection.
                        lock (_lockObject)
                        {
                            results.Add(newResult);
                        }
                    }
                }
            } while (reader.ReadToFollowing("item"));
            return results;
        }
开发者ID:Tinytoot,项目名称:G2PO,代码行数:34,代码来源:SearchResultParser.cs

示例13: ExamQuestion

        public ExamQuestion(XmlReader reader)
            : this()
        {
            QuestionIdentifier = reader.GetAttribute("identifier");
            Question = reader.GetAttribute("question");
            Image = reader.GetAttribute("image");

            while (!reader.EOF)
            {
                switch (reader.NodeType)
                {
                    case XmlNodeType.Element:
                        if (reader.Name == "Answer")
                            Answer = reader.ReadElementContentAsString();
                        else if (reader.Name == "Distractor")
                            Distractors.Add(reader.ReadElementContentAsString());
                        else
                            reader.Read();
                        break;
                    case XmlNodeType.EndElement:
                        return;
                    default:
                        reader.Read();
                        break;
                }
            }
        }
开发者ID:jstoddard,项目名称:ExamCreator,代码行数:27,代码来源:ExamQuestion.cs

示例14: ReadXml

        protected virtual void ReadXml(XmlReader reader, SyndicationFeed result)
        {
            if (result == null)
                throw new ArgumentNullException("result");
            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.ReadElementContentAsString());
                else if (reader.IsStartElement("link"))
                    result.Links.Add(new SyndicationLink(new Uri(reader.ReadElementContentAsString())));
                else if (reader.IsStartElement("description"))
                    result.Description = new TextSyndicationContent(reader.ReadElementContentAsString());            
                else
                    reader.Skip();
            }
            reader.ReadEndElement();                // Read in </channel>

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

                    break;
                }
                reader.Skip();
            }
        }
开发者ID:ledgarl,项目名称:Samples,代码行数:33,代码来源:Rss10FeedFormatter.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.ReadElementContentAsString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。