using System;
using System.IO;
using System.Xml;

namespace V5.AutoUpdate
{
	/// <summary>
	/// XmlFiles µÄÕªÒªËµÃ÷¡£
	/// </summary>
	public class XmlFiles:XmlDocument
	{
		#region ×Ö¶ÎÓëÊôÐÔ
		private string _xmlFileName;
		public string XmlFileName
		{
			set{_xmlFileName = value;}
			get{return _xmlFileName;}
		}
		#endregion

		public XmlFiles(string xmlFile)
		{
			XmlFileName = xmlFile;
			
			this.Load(xmlFile);
		}
		/// <summary>
		/// ¸ø¶¨Ò»¸ö½ÚµãµÄxPath±í´ïÊ½²¢·µ»ØÒ»¸ö½Úµã
		/// </summary>
		/// <param name="node"></param>
		/// <returns></returns>
		public XmlNode FindNode(string xPath)
		{
			XmlNode xmlNode = this.SelectSingleNode(xPath);
			return xmlNode;
		}
		/// <summary>
		/// ¸ø¶¨Ò»¸ö½ÚµãµÄxPath±í´ïÊ½·µ»ØÆäÖµ
		/// </summary>
		/// <param name="xPath"></param>
		/// <returns></returns>
		public string GetNodeValue(string xPath)
		{
			XmlNode xmlNode = this.SelectSingleNode(xPath);
			return xmlNode.InnerText;
		}
		/// <summary>
		/// ¸ø¶¨Ò»¸ö½ÚµãµÄ±í´ïÊ½·µ»Ø´Ë½ÚµãÏÂµÄº¢×Ó½ÚµãÁÐ±í
		/// </summary>
		/// <param name="xPath"></param>
		/// <returns></returns>
		public XmlNodeList GetNodeList(string xPath)
		{
			XmlNodeList nodeList = this.SelectSingleNode(xPath).ChildNodes;
			return nodeList;

		}

	}
}
