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


C# XmlTextReader.MoveToNextAttribute方法代码示例

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


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

示例1: LoadVideoFile

 public List<string> LoadVideoFile(string file)
 {
     List<string> videos = new List<string>();
     using (XmlReader reader = new XmlTextReader(file))
     {
         do
         {
             switch (reader.NodeType)
             {
                 case XmlNodeType.Element:
                     reader.MoveToFirstAttribute();
                     title.Add(reader.Value);
                     reader.MoveToNextAttribute();
                     author.Add(reader.Value);
                     reader.MoveToNextAttribute();
                     videos.Add(reader.Value);
                     WriteXNBVideoData(reader.Value);
                     break;
             }
         } while (reader.Read());
     }
     title.RemoveAt(0);
     author.RemoveAt(0);
     videos.RemoveAt(0);
     return videos;
 }
开发者ID:stpettersens,项目名称:Presenter,代码行数:26,代码来源:VideoLoader.cs

示例2: ListPlaces

 public static void ListPlaces()
 {
     string siteDir = HttpContext.Current.Server.MapPath(@"\");
     XmlTextReader reader = new XmlTextReader(siteDir + InputFile);
     Hall pList = new Hall();
     Places p = null;
     int category = 0;
     int series = 0;
     int place = 0;
     while (reader.Read())
     {
         if (reader.NodeType == XmlNodeType.Element)
         {
             switch (reader.Name)
             {
                 case "category":
                     reader.MoveToNextAttribute();
                     category = Int32.Parse(reader.Value);
                     break;
                 case "row":
                     reader.MoveToNextAttribute();
                     series = Int32.Parse(reader.Value);
                     break;
                 case "seat":
                     reader.Read();
                     place = Int32.Parse(reader.Value);
                     p = new Places(series, place, category);
                     pList.Add(p);
                     break;
             }
         }
     }
 }
开发者ID:ffblk,项目名称:epam,代码行数:33,代码来源:Hall.cs

示例3: readXml

        public void readXml()
        {
            using (XmlTextReader reader = new XmlTextReader("dump.xml"))
            {
                reader.ReadToFollowing("range");
                while (reader.EOF == false)
                {

                    reader.MoveToFirstAttribute();
                    rangeNameList.Add(reader.Value);
                    reader.MoveToNextAttribute();
                    string temp = (reader.Value);
                    rangeNameList.Add(temp);
                    rangeStartList.Add(Int32.Parse(reader.Value, System.Globalization.NumberStyles.HexNumber));
                    reader.MoveToNextAttribute();
                    temp = (reader.Value);
                    rangeNameList.Add(temp);
                    int temp1 = (Int32.Parse(reader.Value, System.Globalization.NumberStyles.HexNumber));
                    int temp2 = rangeStartList[rangeStartList.Count-1];
                    rangeLengthList.Add(temp1-temp2);

                    reader.ReadToFollowing("range");
                }

            }
        }
开发者ID:Merp,项目名称:SharpTune,代码行数:26,代码来源:DumpXML.cs

示例4: GetJumpUrlToNextPage

 public string GetJumpUrlToNextPage(System.Web.HttpServerUtility server,string url, string valueKey)
 {
     if (!url.ToLower().Contains(".xml"))
     {
         url += ".xml";
     }
     XmlTextReader objXMLReader = new XmlTextReader(server.MapPath(url));
     string strNodeResult = "";
     while (objXMLReader.Read())
     {
         if (objXMLReader.NodeType.Equals(XmlNodeType.Element))
         {
             if (objXMLReader.AttributeCount > 0)
             {
                 while (objXMLReader.MoveToNextAttribute())
                 {
                     if ("id".Equals(objXMLReader.Name) && valueKey.Equals(objXMLReader.Value))
                     {
                         if (objXMLReader.MoveToNextAttribute())
                         {
                             strNodeResult = objXMLReader.Value;
                         }
                     }
                 }
             }
         }
     }
     return strNodeResult;
 }
开发者ID:Dhenskr,项目名称:hoyi-entities,代码行数:29,代码来源:LoginJumpUrl.cs

示例5: Build

		/**
		 *  Instantiate the sprites variable using SCMLPath in S2USettings
		 * */
		public void Build ()
		{
			string pathScml = S2USettings.Settings.ScmlPath;
			string folderPath = pathScml.Substring (0, pathScml.LastIndexOf ("/") + 1);

			if (!File.Exists (pathScml)) {
				Debug.LogErrorFormat ("Unable to open SCML Follower File '{0}'. Reason: File does not exist", pathScml);
				return;
			}


			int id = 0;
			int folderId = 0;
	
			XmlTextReader reader = new XmlTextReader (pathScml);

			while (reader.Read()) {
				switch (reader.NodeType) {
				case XmlNodeType.Element: // The node is an element.
					if (reader.Name == "folder") {
						
						while (reader.MoveToNextAttribute()) { // Read the attributes.
							if (reader.Name == "id") {
								folderId = Int32.Parse (reader.Value);
								sprites.Add (folderId, new List<Sprite> ());
							}
						}
					}
					if (reader.Name == "file") {
						while (reader.MoveToNextAttribute()) { // Read the attributes.
							if (reader.Name == "id") {
								id = Int32.Parse (reader.Value);
							}
							if (reader.Name == "name") {
								sprites [folderId].Insert (id, (Sprite)AssetDatabase.LoadAssetAtPath (folderPath + reader.Value, typeof(Sprite)));

								if (sprites [folderId] [id] == null) {
									Debug.LogErrorFormat ("Sprite {0} is missing from ressources, this might cause issues", reader.Value);
								}
							}
							
						}
					}

					break;
				}
			}
			reader.Close ();
		}
开发者ID:plagas36,项目名称:Spriter2UnityDX,代码行数:52,代码来源:ScmlFollower.cs

示例6: LoadSettings

        public void LoadSettings()
        {
            if (!File.Exists("settings.xml")) return;

            var reader = new XmlTextReader("settings.xml");

            while (reader.Read())
            {
                switch (reader.NodeType)
                {
                    case XmlNodeType.Element: // The node is an element.
                        Console.Write("<" + reader.Name);

                        while (reader.MoveToNextAttribute()) // Read the attributes.
                            Console.Write(" " + reader.Name + "='" + reader.Value + "'");
                        Console.WriteLine(">");
                        break;
                    case XmlNodeType.Text: //Display the text in each element.
                        Console.WriteLine(reader.Value);
                        break;
                    case XmlNodeType.EndElement: //Display the end of the element.
                        Console.Write("</" + reader.Name);
                        Console.WriteLine(">");
                        break;
                }
            }
        }
开发者ID:platonicvizard,项目名称:ContentSyncronizer,代码行数:27,代码来源:ContentSyncronizer.cs

示例7: Cargar

        public override void Cargar(XmlTextReader reader, ETLConfig configuracion)
        {
            if ((reader.NodeType != XmlNodeType.Element) ||
                (reader.Name != entidad))
            {
                ErrorEntidad(entidad);
            }

            string id    = null;
            string val   = null;

            // carga los atributos
            while (reader.MoveToNextAttribute())
            {
                switch (reader.Name)
                {
                    case "id"   : id    = reader.Value; break;
                    case "val"  : val   = reader.Value; break;
                    default     : ErrorAtributo(entidad,
                        reader.Name, reader.Value, reader.LineNumber);
                        break;
                }
            }
            // carga el id
            if (id != null) this.id = id;
            // carga el valor
            if (val != null) this.valor = val;
        }
开发者ID:jesuspv,项目名称:ETLGen,代码行数:28,代码来源:SpGenerador.cs

示例8: GetDatabaseFieldAttributeFromODT

        /// <summary>
        /// Liest die Werte von einem Attributs eines Datenquellen-verknüpften Feldes aus einer OpenDocument 1.2-basierter Datei aus
        /// mögliche Attribute: text:table-name, text:column-name, text:database-name, text:table-type
        /// </summary>
        /// <param name="filePath">auszulesende Datei</param>
        /// <param name="attribute">auszulesendes Attribut</param>
        /// <returns>Liste von Strings</returns>
        public static IEnumerable<string> GetDatabaseFieldAttributeFromODT(string filePath, string attribute)
        {
            IList<string> attributeValues = new List<string>();

            try
            {
                using (ZipFile zip = ZipFile.Read(filePath))
                {
                    using (var stream = zip["content.xml"].OpenReader())
                    {
                        using (var content = new StreamReader(stream))
                        {
                            using (var xmlReader = new XmlTextReader(content))
                            {
                                while (xmlReader.Read())
                                {
                                    if (xmlReader.NodeType == XmlNodeType.Element)             // check for XML node
                                        if (xmlReader.Name == "text:database-display")         // this is the tag indicating a link to an db/csv value
                                            while (xmlReader.MoveToNextAttribute())            // read its attributes
                                                if (xmlReader.Name == attribute)               // check if it is the attribute we are looking for
                                                    attributeValues.Add(xmlReader.Value);
                                }

                                return attributeValues;
                            }
                        }
                    }
                }
            }
            catch
            {
                return attributeValues;
            }
        }
开发者ID:ramteid,项目名称:KoeTaf,代码行数:41,代码来源:LibreOffice.cs

示例9: HandleFurnidata

 public void HandleFurnidata(string[] items)
 {
     int count = 0;
     int error = 0;
     XmlTextReader reader = new XmlTextReader("figuremap.xml");
     WebClient webClient = new WebClient();
     string production = "";
     Console.WriteLine("Name the SWF Build (for example: PRODUCTION-201507062205-18729)");
     production = Console.ReadLine();
     while(reader.Read())
     {
         if (reader.Name == "lib" && reader.NodeType == XmlNodeType.Element)
         {
             while (reader.MoveToNextAttribute())
             {
                 int idk = 0;
                 if (reader.Name == "id" && !int.TryParse(reader.Value, out idk))
                 {
                     try
                     {
                         Console.Write("Downloading cloth " + reader.Value + "                  ");
                         Console.SetCursorPosition(0, Console.CursorTop);
                         webClient.DownloadFile("http://images-eussl.habbo.com/dcr/gordon/" + production + "/" + reader.Value + ".swf", "swfs/clothes/" + reader.Value + ".swf");
                         count++;
                     }
                     catch
                     {
                         error++;
                     }
                 }
             }
         }
     }
     Console.WriteLine("Finished (" + count + " successful, " + error + " errors)! Press the any key for the main menu.");
 }
开发者ID:RootkitR,项目名称:FurniUtils,代码行数:35,代码来源:DownloadClothes.cs

示例10: button1_Click

        private void button1_Click(object sender, EventArgs e)
        {
            XmlTextReader tr =
                new XmlTextReader(@"D:\MS.Net\CSharp\XMLParser\XMLParser\Emp.xml");
            while (tr.Read())
            {
                //Check if it is a start tag
                if (tr.NodeType == XmlNodeType.Element)
                {
                    listBox1.Items.Add(tr.Name);
                    if (tr.HasAttributes)
                    {
                        tr.MoveToFirstAttribute();
                        string str = tr.Name;
                        str += " = ";
                        str += tr.Value;
                        listBox1.Items.Add(str);
                    }
                    if (tr.MoveToNextAttribute())
                    {

                        string str = tr.Name;
                        str += " = ";
                        str += tr.Value;
                        listBox1.Items.Add(str);
                    }
                }
                if (tr.NodeType == XmlNodeType.Text)
                {
                    listBox1.Items.Add(tr.Value);
                }

            }
        }
开发者ID:prijuly2000,项目名称:Dot-Net,代码行数:34,代码来源:Form2.cs

示例11: EnumerateAttributes

        private int EnumerateAttributes(string elementStartTag, Action<int, int, string> onAttributeSpotted)
        {
            bool selfClosed = (elementStartTag.EndsWith("/>", StringComparison.Ordinal));
            string xmlDocString = elementStartTag;
            if (!selfClosed)
            {
                xmlDocString = elementStartTag.Substring(0, elementStartTag.Length-1) + "/>" ;
            }

            XmlTextReader xmlReader = new XmlTextReader(new StringReader(xmlDocString));

            xmlReader.Namespaces = false;
            xmlReader.Read();

            bool hasMoreAttributes = xmlReader.MoveToFirstAttribute();
            while (hasMoreAttributes)
            {
                onAttributeSpotted(xmlReader.LineNumber, xmlReader.LinePosition, xmlReader.Name);
                hasMoreAttributes = xmlReader.MoveToNextAttribute();
            }

            int lastCharacter = elementStartTag.Length;
            if (selfClosed)
            {
                lastCharacter--;
            }
            return lastCharacter;
        }
开发者ID:vipwan,项目名称:CommunityServer,代码行数:28,代码来源:XmlAttributePreservationDict.cs

示例12: Main

        public static void Main(string[] args)
        {
            XmlTextReader xmlReader = new XmlTextReader ("Book.xml");

            while(xmlReader.Read()){
                switch (xmlReader.NodeType) {

                case XmlNodeType.Element:
                    Console.WriteLine ("This is XmlNodeType.Element");
                    Console.Write ("<" + xmlReader.Name);

                    //Reading Attributes of XML Element
                    while (xmlReader.MoveToNextAttribute()) // Read the attributes.
                        Console.Write(" " + xmlReader.Name + "='" + xmlReader.Value + "'");
                    //
                    Console.WriteLine (">");
                    break;

                case XmlNodeType.Text: //Display the text in each element.
                    Console.WriteLine("This is xmlNodeType.Text");
                    Console.WriteLine (xmlReader.Value);
                    break;

                case XmlNodeType.EndElement: //Display the end of the element.
                    Console.WriteLine("This is xmlNodeType.EndElement");
                    Console.Write("</" + xmlReader.Name);
                    Console.WriteLine(">");
                    break;
                }
            }
            Console.WriteLine ("XMl Reading Has Completed");
        }
开发者ID:pRivAte12,项目名称:TIL,代码行数:32,代码来源:XMLReading.cs

示例13: Load

        /// <summary>
        /// TODO: Multiple spawns please.
        /// </summary>
        /// <param name="world"></param>
        public static void Load(GameWorld world)
        {
            string path = Config.GetDataPath() + "world/spawns.xml";
            XmlTextReader reader = new XmlTextReader(path);
            Respawn currentRespawn = null;
            while (reader.Read()) {
                switch (reader.NodeType) {
                    case XmlNodeType.Element:
                        while (reader.MoveToNextAttribute()) // Read attributes
                            {
                            if (reader.Name == "centerx") {
                                currentRespawn = new Respawn(world);
                                currentRespawn.CenterX = ushort.Parse(reader.Value);
                            } else if (reader.Name == "centery") {
                                currentRespawn.CenterY = ushort.Parse(reader.Value);
                            } else if (reader.Name == "centerz") {
                                currentRespawn.CenterZ = byte.Parse(reader.Value);
                            } else if (reader.Name == "radius") {
                                currentRespawn.Radius = int.Parse(reader.Value);
                            } else if (reader.Name == "name") {
                                currentRespawn.MonsterName = reader.Value;
                            } else if (reader.Name == "spawntime") {
                                if (currentRespawn.CanSpawn()) {
                                    currentRespawn.Spawn();
                                }
                                //currentRespawn.SpawnTime = 100 * int.Parse(reader.Value);
                            }
                        }
                        break;
                }
            }

            reader.Close();
        }
开发者ID:brewsterl,项目名称:cyclops,代码行数:38,代码来源:respawn.cs

示例14: loadXMLMap

        /// <summary>Loads the map from the XML file</summary>
        /// <param name="name">File name of the map</param>
        public void loadXMLMap()
        {
            
            XmlTextReader reader = new XmlTextReader("maps/xml/" + id + ".tmx");

            int i = 0;
            int j = 0;
            while (reader.Read())
            {
                // http://msdn.microsoft.com/fr-fr/library/9b9dty7d(VS.80).aspx

                if (reader.NodeType == XmlNodeType.Element) // The node is an element.
                {
                    while (reader.MoveToNextAttribute())
                    { // Read the attributes.
                        if (reader.Name == "gid")
                        {
                            TabMap[i, j] = Convert.ToInt32(reader.Value);
                            if (i == 19)
                            {
                                i = 0;
                                j++;
                            }
                            else
                            {
                                i++;
                            }
                        }
                    }
                }

            }
        }
开发者ID:TerenceWallace,项目名称:bloodbox,代码行数:35,代码来源:MapDrawer.cs

示例15: local

 /// <summary>
 /// Sets the Language Content and reads it from an XML File.
 /// </summary>
 public void local(String s)
 {
     try
     {
         String sFilename = Directory.GetCurrentDirectory() + "/" + s;
         XmlTextReader reader = new XmlTextReader(sFilename);
         reader.Read();
         reader.Read();
         int count = 4;
         String[] t = new String[count];
         String[] t2 = new String[count];
         for (int i = 0; i < count; i++)
         {
             reader.Read();
             reader.Read();
             t[i] = reader.Name;
             reader.MoveToNextAttribute();
             t2[i] = reader.Value;
             if (t2[i] == "")
             {
                 throw new XmlException("datei nicht lang genug");
             }
         }
         label1.Content = t2[0];
         label2.Content = t2[1];
         label3.Content = t2[2];
         tb1.Text = t2[3];
     }
     catch (IndexOutOfRangeException) { }
     catch (FileNotFoundException) { }
     catch (XmlException) { }
 }
开发者ID:PSE-2012,项目名称:MMWTV,代码行数:35,代码来源:VM_Greyscale.xaml.cs


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