public class ConfigurationLocation
{
+ static readonly char[] pathTrimChars = { '/' };
+
string path;
Configuration configuration;
Configuration parent;
internal ConfigurationLocation (string path, string xmlContent, Configuration parent, bool allowOverride)
{
+ if (!String.IsNullOrEmpty (path)) {
+ switch (path [0]) {
+ case ' ':
+ case '.':
+ case '/':
+ case '\\':
+ throw new ConfigurationErrorsException ("<location> path attribute must be a relative virtual path. It cannot start with any of ' ' '.' '/' or '\\'.");
+ }
+
+ path = path.TrimEnd (pathTrimChars);
+ }
+
this.path = path;
this.xmlContent = xmlContent;
this.parent = parent;
}
}
- configuration = new Configuration (parent);
- using (XmlTextReader tr = new XmlTextReader (new StringReader (xmlContent)))
+ configuration = new Configuration (parent, path);
+ using (XmlTextReader tr = new ConfigXmlTextReader (new StringReader (xmlContent), path))
configuration.ReadData (tr, allowOverride);
xmlContent = null;
internal void SetParentConfiguration (Configuration parent)
{
+ if (parentResolved)
+ return;
+
parentResolved = true;
this.parent = parent;
if (configuration != null)