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


C# XmlTextReader.ReadInnerXml方法代码示例

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


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

示例1: GetItemsList

    public string[] GetItemsList(string prefixText, int count)
    {
        List<string> suggestions = new List<string>();
            using (XmlTextReader reader = new XmlTextReader(HttpContext.Current.Server.MapPath("flightdata.xml")))
            {
                while (reader.Read())
                {
                    if (reader.NodeType == XmlNodeType.Element && reader.Name == "departurelocation")
                    {
                        string itemName = reader.ReadInnerXml();
                        if (itemName.StartsWith(prefixText, StringComparison.InvariantCultureIgnoreCase))
                        {
                            if (!suggestions.Contains(itemName))
                            suggestions.Add(itemName);

                            if (suggestions.Count == count) break;
                        }
                    }

                    if (reader.NodeType == XmlNodeType.Element && reader.Name == "destinationlocation")
                    {
                        string itemName = reader.ReadInnerXml();
                        if (itemName.StartsWith(prefixText, StringComparison.InvariantCultureIgnoreCase))
                        {
                            if (!suggestions.Contains(itemName))
                            suggestions.Add(itemName);

                            if (suggestions.Count == count) break;
                        }
                    }

                }
            }
            return suggestions.ToArray();
    }
开发者ID:marvinrusinek,项目名称:Skyscanner,代码行数:35,代码来源:Autocomplete.cs

示例2: GetAlbumArt

    protected void GetAlbumArt(string albumId, string album, string artist)
    {
        string path = Server.MapPath(@"~/images/cover-art/");

        if(!File.Exists(path + albumId + ".png")){
            string url = "http://ws.audioscrobbler.com/2.0/?method=album.getinfo&api_key=b25b959554ed76058ac220b7b2e0a026&artist=" + artist + "&album=" + album;
            try
            {
                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
                request.Method = "GET";
                HttpWebResponse response = (HttpWebResponse)request.GetResponse();

                XmlTextReader reader = new XmlTextReader(response.GetResponseStream());
                while (reader.Read())
                {
                    if (reader.NodeType == XmlNodeType.Element && reader.Name == "image")
                    {
                        if (reader.GetAttribute("size").Equals("large"))
                        {
                            url = reader.ReadInnerXml();

                            WebClient webClient = new WebClient();
                            webClient.DownloadFile(url, path + albumId + ".png");
                        }
                    }
                }
            }
            catch (Exception e)
            {
            }
        }
    }
开发者ID:dantomosoiu,项目名称:MusicMachine,代码行数:32,代码来源:UploadSong.aspx.cs

示例3: TextureAssetSettings

 public TextureAssetSettings(XmlTextReader reader)
 {
     if(reader.MoveToAttribute("path"))
         path = reader.Value;
     while(reader.Read()) {
         if(reader.NodeType == XmlNodeType.EndElement && reader.Name == "TextureAsset") {
             reader.ReadEndElement();
             break;
         }
         if(reader.NodeType == XmlNodeType.Element && reader.Name == "maxSize") {
             maxSize = int.Parse(reader.ReadInnerXml());
         } else if(reader.NodeType == XmlNodeType.Element && reader.Name == "format") {
             format = (TextureImporterFormat) System.Enum.Parse(typeof(TextureImporterFormat), reader.ReadInnerXml());
         } else if(reader.NodeType == XmlNodeType.Element && reader.Name == "mipmaps") {
             mipmaps = bool.Parse(reader.ReadInnerXml());
         } else if(reader.NodeType == XmlNodeType.Element && reader.Name == "npotScale") {
             npotScale = (TextureImporterNPOTScale) System.Enum.Parse(typeof(TextureImporterNPOTScale), reader.ReadInnerXml());
         }
     }
 }
开发者ID:azanium,项目名称:TruthNIslam-Unity,代码行数:20,代码来源:TextureAssetSettings.cs

示例4: selectCharGUI

    void selectCharGUI()
    {
        if (reader != null)
        {
            reader.Close();
            reader = null;
        }
        reader = new XmlTextReader(Application.dataPath + "/Resources/Characters/Characters.char");

        GUI.Label(new Rect(Screen.width * 0.125f, Screen.height * 0.05f, Screen.width * 0.75f, Screen.height * 0.05f), "Select Character...");

        Vector2 scrollPos = Vector2.zero;
        scrollPos = GUI.BeginScrollView(new Rect(Screen.width * 0.125f, Screen.height * 0.1f, Screen.width * 0.75f, Screen.height * 0.8f), scrollPos, new Rect(0, 0, Screen.width * 0.75f, 200));

        int i = 0;
        int boxHeight = 20;
        int spacing = 5;
        while(reader.Read())
        {
            XmlNodeType nType = reader.NodeType;
            if(nType == XmlNodeType.Element && reader.Name == "Character")
            {
                GUI.Box(new Rect(0, i * (boxHeight + spacing), Screen.width * 0.75f, boxHeight), "");
                GUILayout.BeginHorizontal();

                    GUI.Label(new Rect(5, i * (boxHeight + spacing), Screen.width * 0.20f, boxHeight), reader.GetAttribute("name"));
                    GUI.Label(new Rect(Screen.width * 0.25f, i * (boxHeight + spacing), Screen.width * 0.20f, boxHeight), reader.GetAttribute("subname"));

                if(GUI.Button(new Rect(Screen.width * 0.50f, i * (boxHeight + spacing), Screen.width * 0.24f, boxHeight), "Build..."))
                {
                    charSubName = reader.GetAttribute("subname");
                    string charname = reader.GetAttribute("name");
                    string file = reader.ReadInnerXml();
                    Debug.Log ("Constructing Character: " + charSubName + " " + charname + " from file " + file);
                    charToBuild = Application.dataPath + "/Resources/Characters/" + file;
                }

                GUILayout.EndHorizontal();
                i++;
            }

        }

        GUI.EndScrollView();
    }
开发者ID:gogolB,项目名称:NuGame,代码行数:45,代码来源:CharTesterGUI.cs

示例5: GetStationNames

    public String[] GetStationNames(string prefixText, int count)
    {
        List<string> suggestions = new List<string>();

        using (XmlTextReader reader = new XmlTextReader(HttpContext.Current.Server.MapPath("stations.xml")))
        {
            while (reader.Read())
            {
                if (reader.NodeType == XmlNodeType.Element && reader.Name == "station")
                {
                    string name = reader.ReadInnerXml();
                    if (name.StartsWith(prefixText, StringComparison.InvariantCultureIgnoreCase))
                    {
                        suggestions.Add(name);
                        if (suggestions.Count == count) break;
                    }
                }
            }
        }

        return suggestions.ToArray();
    }
开发者ID:Jan-Bart,项目名称:Not-a-school-project,代码行数:22,代码来源:stationsXML.cs

示例6: parseXML

 private Dictionary<string, string> parseXML(string XML)
 {
     if (XML == string.Empty) return new Dictionary<string, string>(); // Catch empty response
     Dictionary<string, string> parameters = new Dictionary<string, string>();
     XmlTextReader reader = new XmlTextReader(new System.IO.StringReader(XML));
     reader.MoveToContent();
     while (reader.Read())
     {
         reader.MoveToContent();
         parameters.Add(reader.Name,reader.ReadInnerXml().ToString());
     }
     return parameters;
 }
开发者ID:defcon8,项目名称:GNURender,代码行数:13,代码来源:xmlrpc.cs

示例7: LoadObject

	private void LoadObject(object objParent, string sXML, NodeStyle ns)
	{
		if (sXML.Length == 0) return;

		XmlTextReader tr = new XmlTextReader(sXML, System.Xml.XmlNodeType.Element , null);		

		bool NextElement = true;

		while (NextElement)
		{
			while (tr.Read())
				if (tr.IsStartElement()) break;

			string ElementName = tr.LocalName;

			if (ElementName.Length == 0) break;

			Type t1 = objParent.GetType();			
			
			PropertyInfo pi1 = t1.GetProperty(ElementName);
			
			this.SetPropertyObject(objParent, pi1, tr, ns);

			//hledani koncoveho tagu
			int j = 0;
			while (tr.Read())
				if (tr.LocalName.ToUpper() == ElementName.ToUpper())
				{
					if (tr.IsStartElement()) j++;
					else j--;
			
					if (j == -1) break;
				}
			
			if (tr.ReadState == ReadState.EndOfFile) NextElement = false;						

		}
		
		tr.Close();

		//zpracovani child tagu
		tr = new XmlTextReader(sXML, System.Xml.XmlNodeType.Element , null);

		NextElement = true;

		while (NextElement)
		{
			while (tr.Read())
				if (tr.IsStartElement()) break;

			string ElementName = tr.LocalName;

			if (ElementName.Length == 0) break;

			Type t1 = objParent.GetType();
			
			PropertyInfo pi1 = t1.GetProperty(ElementName);			

			object obj = (System.Type.GetType(pi1.GetType().Name));
			obj = pi1.GetValue(objParent,null);
			
			this.LoadObject(obj, tr.ReadInnerXml(), ns);

		}

		tr.Close();

	}
开发者ID:ChrisMoreton,项目名称:Test3,代码行数:68,代码来源:TreeViewXML.cs

示例8: LoadFromXML

	public void LoadFromXML(System.IO.Stream oStream)
	{
		xtr = new System.Xml.XmlTextReader(oStream);

		while (xtr.Read())
		{
			if (xtr.IsStartElement())
			{
				if ((xtr.LocalName.ToUpper() == "TREEVIEWSTYLES") && (this.TreeViewStyle))
					LoadObject(oTV, xtr.ReadInnerXml(), oTV.Style.NodeStyle);

				if ((xtr.LocalName.ToUpper() == "TREEVIEWCONTENT") && (this.TreeViewContent))
					LoadNodes(oTV, xtr.ReadInnerXml());
			}
		}
	}
开发者ID:ChrisMoreton,项目名称:Test3,代码行数:16,代码来源:TreeViewXML.cs

示例9: loadBuffs

    IEnumerator loadBuffs()
    {
        foreach(KeyValuePair<string, int> entry in attribs)
        {
            string filename = entry.Key.Substring(entry.Key.LastIndexOf("|") + 1).Replace(" ", "_") + ".attribute";
            filename = Application.dataPath + "/Resources/Attributes/" + filename;
            if(File.Exists(filename))
            {
                XmlTextReader reader = new XmlTextReader(filename);
                Character_Factory.skipToAttribute(reader, "Level", "name", entry.Value + "");
                while(reader.Read())
                {
                    XmlNodeType type = reader.NodeType;
                    if(type == XmlNodeType.Element)
                    {
                        if(reader.Name == "buff")
                        {
                            string buffName = reader.GetAttribute("name");
                            string value = reader.ReadInnerXml();
                            setBuff(buffName, int.Parse(value), true);
                        }
                    }
                }
                reader.Close();

            }
            else
            {
                Debug.LogError("Could not find attribute file: " + filename);
                #if UNITY_EDITOR
                Debug.Break();
                #endif
            }
            yield return 0;
        }
    }
开发者ID:gogolB,项目名称:NuGame,代码行数:36,代码来源:Player_Character.cs


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