Sage.Configuration.PathTemplates.Parse C# (CSharp) Method

Parse() public method

Parses the specified configuration element and copies any applicable values into the current instance.
public Parse ( XmlElement configElement ) : void
configElement System.Xml.XmlElement The configuration element to parse.
return void
        public void Parse(XmlElement configElement)
        {
            Contract.Requires<ArgumentNullException>(configElement != null);

            XmlNamespaceManager nm = XmlNamespaces.Manager;
            string testValue;

            XmlNode testNode = configElement.SelectSingleNode("p:View", nm);
            if (testNode != null && !string.IsNullOrEmpty(testValue = testNode.InnerText))
                this.View = testValue.TrimEnd('/') + "/";

            testNode = configElement.SelectSingleNode("p:Module", nm);
            if (testNode != null && !string.IsNullOrEmpty(testValue = testNode.InnerText))
                this.Module = testValue.TrimEnd('/') + "/";

            testNode = configElement.SelectSingleNode("p:Extension", nm);
            if (testNode != null && !string.IsNullOrEmpty(testValue = testNode.InnerText))
                this.Extension = testValue.TrimEnd('/') + "/";

            testNode = configElement.SelectSingleNode("p:CategoryConfiguration", nm);
            if (testNode != null && !string.IsNullOrEmpty(testValue = testNode.InnerText))
                this.CategoryConfiguration = testValue;

            testNode = configElement.SelectSingleNode("p:DefaultStylesheet", nm);
            if (testNode != null && !string.IsNullOrEmpty(testValue = testNode.InnerText))
                this.DefaultStylesheet = testValue;

            testNode = configElement.SelectSingleNode("p:ModuleStylesheet", nm);
            if (testNode != null && !string.IsNullOrEmpty(testValue = testNode.InnerText))
                this.ModuleStylesheet = testValue;

            testNode = configElement.SelectSingleNode("p:Dictionary", nm);
            if (testNode != null && !string.IsNullOrEmpty(testValue = testNode.InnerText))
                this.Dictionary = testValue;

            testNode = configElement.SelectSingleNode("p:SiteMap", nm);
            if (testNode != null && !string.IsNullOrEmpty(testValue = testNode.InnerText))
                this.SiteMap = testValue;

            testNode = configElement.SelectSingleNode("p:GlobalizedDirectory", nm);
            if (testNode != null && !string.IsNullOrEmpty(testValue = testNode.InnerText))
                this.GlobalizedDirectory = testValue;

            testNode = configElement.SelectSingleNode("p:GlobalizedDirectoryForNonFileResources", nm);
            if (testNode != null && !string.IsNullOrEmpty(testValue = testNode.InnerText))
                this.GlobalizedDirectoryForNonFileResources = testValue;
        }