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


C# XmlTextReader.ReadInnerXml方法代码示例

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


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

示例1: FromFile

        public void FromFile(string filename, out string[] layerNameArray, out string[] collisionNameArray)
        {
            List<string> layerNames = new List<string>();
            List<string> collisionNames = new List<string>();

            XmlTextReader reader = new XmlTextReader(filename);

            while (reader.Read())
            {
                if (reader.NodeType == XmlNodeType.Element)
                {
                    if (reader.Name == "CollisionLayer")
                    {
                        collisionNames.Add(reader.ReadInnerXml());
                    }

                    if (reader.Name == "TileLayer")
                    {
                        layerNames.Add(reader.ReadInnerXml());
                    }
                }
            }
            reader.Close();

            collisionNameArray = collisionNames.ToArray();
            layerNameArray = layerNames.ToArray();
        }
开发者ID:Siryu,项目名称:RPG-game,代码行数:27,代码来源:TileMap.cs

示例2: ReadDefects

		void ReadDefects (string filename)
		{
			using (XmlTextReader reader = new XmlTextReader (filename)) {
				Dictionary<string, string> full_names = new Dictionary<string, string> ();
				// look for 'gendarme-output/rules/rule/'
				while (reader.Read () && (reader.Name != "rule"));
				do {
					full_names.Add (reader ["Name"], "R: " + reader.ReadInnerXml ());
				} while (reader.Read () && reader.HasAttributes);

				// look for 'gendarme-output/results/
				while (reader.Read () && (reader.Name != "results"));

				HashSet<string> defects = null;
				while (reader.Read ()) {
					if (!reader.HasAttributes)
						continue;

					switch (reader.Name) {
					case "rule":
						defects = new HashSet<string> ();
						ignore_list.Add (full_names [reader ["Name"]], defects);
						break;
					case "target":
						string target = reader ["Name"];
						if (target.IndexOf (' ') != -1)
							defects.Add ("M: " + target);
						else
							defects.Add ("T: " + target);
						break;
					}
				}
			}
		}
开发者ID:nolanlum,项目名称:mono-tools,代码行数:34,代码来源:gd2i.cs

示例3: getStudentInfoByGet

        //http request bt GET
        //to get info of a student
        public List<String> getStudentInfoByGet(string URL, string ID_No)
        {
            //Create the URL
            List<String> infos = new List<string>();
            String[] functions = { "GetStudentName", "GetStudentGender", "GetStudentMajor", "GetStudentEmailAddress" };
            string function = "";
            for (int i = 0; i < functions.Length; i++)
            {
                function = functions[i];
                string strURL = URL + function + "?ID_No=" + ID_No;

                //Initiate, DO NOT use constructor of HttwWebRequest
                //DO use constructor of WebRequest
                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(strURL);
                request.Method = "GET";
                using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
                {
                    Stream s = response.GetResponseStream();
                    XmlTextReader reader = new XmlTextReader(s);
                    reader.MoveToContent();
                    string xml = reader.ReadInnerXml();
                    ////////
                    xml = xml.Split(new Char[] { '<', '>' })[2];
                    /////////
                    infos.Add(xml);
                }                
            }
            return infos;
        }
开发者ID:juyingnan,项目名称:VS,代码行数:31,代码来源:HttpWebOperation.cs

示例4: CacheDocs

		/// <summary>
		/// Cache the xmld docs into a hashtable for faster access.
		/// </summary>
		/// <param name="reader">An XMLTextReader containg the docs the cache</param>
		private void CacheDocs(XmlTextReader reader)
		{
			object oMember = reader.NameTable.Add("member");
			reader.MoveToContent();

			while (!reader.EOF) 
			{
				if ((reader.NodeType == XmlNodeType.Element) && (reader.Name.Equals(oMember)))
				{
					string ID = reader.GetAttribute("name");
					string doc = reader.ReadInnerXml().Trim();
					doc = PreprocessDoc(ID, doc);
					if (docs.ContainsKey(ID))
					{
						Trace.WriteLine("Warning: Multiple <member> tags found with id=\"" + ID + "\"");
					}
					else
					{
						docs.Add(ID, doc);
					}
				}
				else
				{
					reader.Read();
				}
			}
		}
开发者ID:tgassner,项目名称:NDoc,代码行数:31,代码来源:AssemblyXmlDocCache.cs

示例5: InsertStudentInfoByPost

        //http request bt POST
        //to add new info of a student
        public String InsertStudentInfoByPost(string URL, String Info)
        {
            string strURL = URL+ "InsertStudentInfo";
            
            Encoding myEncoding = Encoding.GetEncoding("utf-8");
            string param = "Info="+ HttpUtility.UrlEncode(Info, myEncoding);
            
            byte[] bs = Encoding.ASCII.GetBytes(param);
            string result="";

            //Initiate, DO NOT use constructor of HttwWebRequest
            //DO use constructor of WebRequest
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(strURL);
            //POST
            request.Method = "POST";
            request.ContentType = "application/x-www-form-urlencoded;charset=utf-8";
            request.ContentLength = bs.Length;
            using (Stream reqStream = request.GetRequestStream())
            {
                reqStream.Write(bs, 0, bs.Length);
            }

            using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
            {
                //DEAL with return values here
                Stream s = response.GetResponseStream();
                XmlTextReader reader = new XmlTextReader(s);
                reader.MoveToContent();
                result = reader.ReadInnerXml();
                ////////
                result=result.Split(new Char[] { '<', '>' })[2];
                /////////
            }
            return result;
        }
开发者ID:juyingnan,项目名称:VS,代码行数:37,代码来源:HttpWebOperation.cs

示例6: InitLanguage

 /// <summary>
 /// 字符资源
 /// </summary>
 /// <param name="LanguageFileName">当前语言文件</param>
 public void InitLanguage(String LanguageFileName)
 {
     String tag = String.Empty;
     String text = String.Empty;
     XmlTextReader reader = new XmlTextReader(LanguageFileName);
     _stringDic.Clear();
     while (reader.Read())
     {
         switch (reader.NodeType)
         {
             case XmlNodeType.Element:
                 // The node is an element.
                 if (reader.Name == "Language")
                 {
                     LanguageType = reader.GetAttribute("Type");
                     continue;
                 }
                 tag = reader.Name.Trim();
                 text = reader.ReadInnerXml().Trim();
                 if (!String.IsNullOrEmpty(tag) && !String.IsNullOrEmpty(text))
                 {
                     _stringDic.Add(tag, text);
                 }
                 break;
             default:
                 break;
         }
     }
 }
开发者ID:Redi0,项目名称:meijing-ui,代码行数:33,代码来源:StringResources.cs

示例7: InitLanguage

        /// <summary>
        /// 字符资源
        /// </summary>
        /// <param name="currentLanguage">当前语言</param>
        public void InitLanguage(Language currentLanguage)
        {
            string tag = string.Empty;
            string text = string.Empty;
            string fileName = string.Format("Language\\{0}.xml", currentLanguage.ToString());
            XmlTextReader reader = new XmlTextReader(fileName);
            while (reader.Read())
            {
                switch (reader.NodeType)
                {
                    case XmlNodeType.Element: // The node is an element.
                        if (reader.Name == "Language")
                        {
                            continue;
                        }
                        tag = reader.Name.Trim();
                        text = reader.ReadInnerXml().Trim();
                        if (!string.IsNullOrEmpty(tag) && !string.IsNullOrEmpty(text))
                        {
                            _stringDic.Add(tag, text);
                            //System.Diagnostics.Debug.WriteLine(tag + ",");
                        }
                        break;
                }

            }
        }
开发者ID:kklik,项目名称:MagicMongoDBTool,代码行数:31,代码来源:StringResources.cs

示例8: SerializeAsXmlNode

		public XmlNode SerializeAsXmlNode(XmlDocument doc)
		{
			System.IO.MemoryStream ms = new MemoryStream();
			XmlSerializer serializer = new XmlSerializer(typeof(ColumnCollection));
			XmlTextReader xRead = null;
			XmlNode xTable = null;
			try
			{
				xTable = doc.CreateNode(XmlNodeType.Element, "TABLE", doc.NamespaceURI);

				serializer.Serialize(ms, this);
				ms.Position = 0;
				xRead = new XmlTextReader( ms );
				xRead.MoveToContent();
				string test = xRead.ReadInnerXml();
				XmlDocumentFragment docFrag = doc.CreateDocumentFragment();
				docFrag.InnerXml = test;

				xTable.AppendChild(docFrag);
			}
			catch(Exception ex)
			{
				throw new Exception("IdentityCollection Serialization Error.", ex);
			}
			finally
			{
				ms.Close();
				if (xRead != null) xRead.Close();
			}
			return xTable;
		}
开发者ID:ViniciusConsultor,项目名称:sqlschematool,代码行数:31,代码来源:IdentityCollection.cs

示例9: InitLanguage

 /// <summary>
 ///     字符资源
 /// </summary>
 /// <param name="languageFileName">当前语言文件</param>
 public static void InitLanguage(string languageFileName)
 {
     var tag = string.Empty;
     var text = string.Empty;
     var reader = new XmlTextReader(languageFileName);
     StringDic.Clear();
     while (reader.Read())
     {
         switch (reader.NodeType)
         {
             case XmlNodeType.Element:
                 // The node is an element.
                 if (reader.Name == "Language")
                 {
                     LanguageType = reader.GetAttribute("Type");
                     continue;
                 }
                 tag = reader.Name.Trim().Replace("_","").ToUpper();
                 text = reader.ReadInnerXml().Trim();
                 if (!string.IsNullOrEmpty(tag) && !string.IsNullOrEmpty(text))
                 {
                     StringDic.Add(tag, text);
                 }
                 break;
             default:
                 break;
         }
     }
 }
开发者ID:universsky,项目名称:MongoCola,代码行数:33,代码来源:StringResource.cs

示例10: GetLocationData

        public static Location GetLocationData(string street,
            string zip,
            string city,
            string state,
            string country)
        {
            // Use an invariant culture for formatting numbers.
             NumberFormatInfo numberFormat = new NumberFormatInfo();
             Location loc = new Location();
             XmlTextReader xmlReader = null;

             try
             {
             HttpWebRequest webRequest = GetWebRequest(street, zip, city, state);
             HttpWebResponse response = (HttpWebResponse)webRequest.GetResponse();

             using (xmlReader = new XmlTextReader(response.GetResponseStream()))
             {
             while (xmlReader.Read())
             {
                 if (xmlReader.NodeType == XmlNodeType.Element && xmlReader.Name == "Result")
                 {
                     XmlReader resultReader = xmlReader.ReadSubtree();
                     while (resultReader.Read())
                     {
                         if (xmlReader.NodeType == XmlNodeType.Element && xmlReader.Name == "Latitude")
                             loc.Latitude = Convert.ToDouble(xmlReader.ReadInnerXml(), numberFormat);

                         if (xmlReader.NodeType == XmlNodeType.Element && xmlReader.Name == "Longitude")
                         {
                             loc.Longitude = Convert.ToDouble(xmlReader.ReadInnerXml(), numberFormat);
                             break;
                         }
                     }
                 }
             }
             }
             }
             finally
             {
               if (xmlReader != null)
            xmlReader.Close();
             }

              // Return the location data.
              return loc;
        }
开发者ID:skt90u,项目名称:skt90u-framework-dotnet,代码行数:47,代码来源:YahooProvider.cs

示例11: AsDataTable

 public static DataTable AsDataTable(this string xmlString)
 {
     DataSet dataSet = new DataSet();
     XmlTextReader reader = new XmlTextReader(new System.IO.StringReader(xmlString));
     reader.Read();
     string inner = reader.ReadInnerXml();
     dataSet.ReadXml(reader);
     return dataSet.Tables[0];
 }
开发者ID:melissahr23,项目名称:BookLibraryWeb,代码行数:9,代码来源:Extensions.cs

示例12: DailyQueueConfiguration

        public DailyQueueConfiguration()
        {
            cookies = new CookieCollection();
            try
            {
                //grab the user and password values from the config file
                using (XmlTextReader reader = new XmlTextReader(CONFIG_XML))
                {
                    while (reader.Read())
                    {
                        switch (reader.NodeType)
                        {
                            case XmlNodeType.Element:
                                if (reader.Name == USER_NODE_NAME)
                                {
                                    user = reader.ReadInnerXml();
                                }
                                else if (reader.Name == PASSWORD_NODE_NAME)
                                {
                                    password = reader.ReadInnerXml();
                                }
                                break;
                        }
                    }
                    reader.Close();
                }
            }
            catch (FileNotFoundException e)
            {
                string msg = e.Message;
                //create the configuration file
                using (XmlWriter writer = XmlWriter.Create(CONFIG_XML))
                {
                    writer.WriteStartDocument();
                    writer.WriteStartElement("config");
                    writer.WriteElementString("user", "");
                    writer.WriteElementString("password", "");
                    writer.WriteEndElement();
                    writer.WriteEndDocument();
                }

            }
        }
开发者ID:calvinwiebe,项目名称:dailyqueuedesktop-win,代码行数:43,代码来源:DailyQueueConfiguration.cs

示例13: Read

        /// <summary>
        /// Read the specified xml and uri.
        /// </summary>
        /// <description>XML is the raw Note XML for each note in the system.</description>
        /// <description>uri is in the format of //tomboy:NoteHash</description>
        /// <param name='xml'>
        /// Xml.
        /// </param>
        /// <param name='uri'>
        /// URI.
        /// </param>
        public static Note Read(XmlTextReader xml, string uri)
        {
            Note note = new Note (uri);
            DateTime date;
            int num;
            string version = String.Empty;

            while (xml.Read ()) {
                switch (xml.NodeType) {
                case XmlNodeType.Element:
                    switch (xml.Name) {
                    case "note":
                        version = xml.GetAttribute ("version");
                        break;
                    case "title":
                        note.Title = xml.ReadString ();
                        break;
                    case "text":
                        // <text> is just a wrapper around <note-content>
                        // NOTE: Use .text here to avoid triggering a save.
                        note.Text = xml.ReadInnerXml ();
                        break;
                    case "last-change-date":
                        if (DateTime.TryParse (xml.ReadString (), out date))
                            note.ChangeDate = date;
                        else
                            note.ChangeDate = DateTime.Now;
                        break;
                    case "last-metadata-change-date":
                        if (DateTime.TryParse (xml.ReadString (), out date))
                            note.MetadataChangeDate = date;
                        else
                            note.MetadataChangeDate = DateTime.Now;
                        break;
                    case "create-date":
                        if (DateTime.TryParse (xml.ReadString (), out date))
                            note.CreateDate = date;
                        else
                            note.CreateDate = DateTime.Now;
                        break;
                    case "x":
                        if (int.TryParse (xml.ReadString (), out num))
                            note.X = num;
                        break;
                    case "y":
                        if (int.TryParse (xml.ReadString (), out num))
                            note.Y = num;
                        break;
                    }
                    break;
                }
            }

            return note;
        }
开发者ID:robpvn,项目名称:tomboy-library,代码行数:66,代码来源:Reader.cs

示例14: ddd

        private void ddd(XYSaleBill sb)
        {
            try
            {
                string url = Common.AppSetting.httpurl;

                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);

                request.Method = "POST";
                request.ContentType = "application/x-www-form-urlencoded";

                string postdata = "body=" + JsonConvert.SerializeObject(sb);

                UTF8Encoding code = new UTF8Encoding();  //这里采用UTF8编码方式
                byte[] data = code.GetBytes(postdata);

                request.ContentLength = data.Length;

                using (Stream stream = request.GetRequestStream()) //获取数据流,该流是可写入的
                {
                    stream.Write(data, 0, data.Length); //发送数据流
                    stream.Close();

                    HttpWebResponse response = (HttpWebResponse)request.GetResponse();

                    Stream ss = response.GetResponseStream();

                    XmlTextReader Reader = new XmlTextReader(ss);
                    Reader.MoveToContent();
                    string status = Reader.ReadInnerXml();

                    if (status == "302")
                    {
                        sb.UpDatePostInfo(1);

                        Common.AppLog.CreateAppLog().Info(string.Format("编号为:{0} 的单据于 {1} 更新成功", sb.sheet_id, DateTime.Now));
                    }
                    else
                    {
                        sb.UpDatePostInfo(0);

                        Common.AppLog.CreateAppLog().Error(string.Format("编号为:{0} 的单据于 {1} 更新失败", sb.sheet_id, DateTime.Now));
                    }
                }

            }
            catch (Exception ex)
            {
                Common.AppLog.CreateAppLog().Error(ex.Message);
            }
        }
开发者ID:vimko,项目名称:SSchema,代码行数:51,代码来源:DoSendDataByPost.cs

示例15: ReadDocumentation

		/// <summary>
		/// Reads the documentation from the XML file provided via <paramref name="fileName"/>.
		/// </summary>
		/// <param name="fileName">Full path to the file containing the documentation.</param>
		public Dictionary<string,string> ReadDocumentation(string fileName)
		{
			XmlReaderSettings settings = new XmlReaderSettings();
			settings.IgnoreComments = true;
			settings.IgnoreWhitespace = true;
			settings.CloseInput = true;

			if (!File.Exists(fileName))
			{
				/// The file either doesn't exist, or JustDecompile doesn't have permissions to read it.
				return new Dictionary<string, string>();
			}

			using (FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.Read | FileShare.Delete))
			{
				Dictionary<string, string> documentationMap = new Dictionary<string, string>();

				using (XmlTextReader reader = new XmlTextReader(fs, XmlNodeType.Element, null))
				{
					try
					{
						while (reader.Read())
						{
							if (reader.NodeType == XmlNodeType.Element)
							{
								if (reader.Name == "member")
								{
									string elementName = reader.GetAttribute("name"); // The assembly member to which the following section is related.
									string documentation = RemoveLeadingLineWhitespaces(reader.ReadInnerXml()); // The documenting section.

									// Keep only the documentation from the last encountered documentation tag. (similar to VS Intellisense)
									documentationMap[elementName] = documentation;									
								}
							}
						}
					}
					catch (XmlException e)
					{ 
						// the XML file containing the documentation is corrupt. 
						return new Dictionary<string,string>();
					}
				}
				return documentationMap;
			}
		}
开发者ID:juancarlosbaezpozos,项目名称:JustDecompileEngine,代码行数:49,代码来源:XmlDocumentationReader.cs


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