// NOTE: This parser takes a path eg. /configuration/system.runtime.remoting // and will return a node which matches this. internal ConfigNode Parse(String fileName, String configPath) { if (fileName == null) { throw new ArgumentNullException("fileName"); } this.fileName = fileName; if (configPath[0] == '/') { treeRootPath = configPath.Substring(1).Split('/'); pathDepth = treeRootPath.Length - 1; bNoSearchPath = false; } else { treeRootPath = new String[1]; treeRootPath[0] = configPath; bNoSearchPath = true; } (new FileIOPermission(FileIOPermissionAccess.Read, System.IO.Path.GetFullPathInternal(fileName))).Demand(); (new SecurityPermission(SecurityPermissionFlag.UnmanagedCode)).Assert(); IConfigHelper ch = ConfigServer.GetHelper(); try { ch.Run(this, fileName); } catch (Exception inner) { throw new ApplicationException(String.Format(Environment.GetResourceString("XML_Syntax_InvalidSyntaxInFile"), fileName, lastProcessed), inner); } return(rootNode); }