home links tips
code users tools tutorials projects web help design
mudabone
suletzki trans48
nutrition reality
MarthaAttire!
| |
using System; using System.Xml; using System.Xml.XPath;
namespace config { /// <summary> /// Summary description for config. /// </summary> public class Config { public Config() { // // TODO: Add constructor logic here // }
private string sFileName;
public Config(string sXMLFileName) { this.sFileName = sXMLFileName; }
/// <summary> /// Get a key or xml fragment from the config file /// </summary> /// <param name="sXPath">XPath to key or xml fragment</param> /// <returns>If XPath returns only one child it returns it's value otherwise /// it retuns the xml fragment</returns> public string getKey(string sXPath) { System.Xml.XmlDataDocument xdd = new XmlDataDocument(); xdd.Load(this.sFileName); System.Xml.XmlNode xn = xdd.SelectSingleNode(sXPath); if (xn.ChildNodes.Count > 1) return xn.OuterXml; else return xn.InnerText; } } }
Last Modified 10/2/03 1:15 PM
| Hide Tools
|