public BlogProviderAccountWizardDescriptionFromXml(string wizardDocumentPath) { // load the xml document XmlDocument wizardDocument = new XmlDocument(); wizardDocument.Load(wizardDocumentPath); // custom account wizard node XmlNode customAccountWizardNode = wizardDocument.SelectSingleNode("//customAccountWizard"); if (customAccountWizardNode == null) { throw new Exception("Required root element customAccountWizard not specified"); } // service name string serviceName = NodeText(customAccountWizardNode.SelectSingleNode("serviceName")); if (serviceName == String.Empty) { throw new Exception("Required element serviceName is not specified or empty"); } // welcome page is optional BlogProviderWelcomePage welcomePage = null; string welcomePageCaption = NodeText(customAccountWizardNode.SelectSingleNode("welcomePage/caption")); string welcomePageText = NodeText(customAccountWizardNode.SelectSingleNode("welcomePage/text")); if (welcomePageCaption != String.Empty && welcomePageText != String.Empty) { welcomePage = new BlogProviderWelcomePage(welcomePageCaption, welcomePageText); } // account creation link is optional BlogProviderAccountCreationLink accountCreationLink = null; string imagePath = NodeText(customAccountWizardNode.SelectSingleNode("accountCreationLink/imagePath")); if (imagePath != String.Empty) { if (!Path.IsPathRooted(imagePath)) { imagePath = Path.Combine(Path.GetDirectoryName(wizardDocumentPath), imagePath); } } string caption = NodeText(customAccountWizardNode.SelectSingleNode("accountCreationLink/caption")); string link = NodeText(customAccountWizardNode.SelectSingleNode("accountCreationLink/link")); if (imagePath != String.Empty && caption != String.Empty && link != String.Empty) { accountCreationLink = new BlogProviderAccountCreationLinkFromFile(imagePath, caption, link); } // initialize Init(serviceName, welcomePage, accountCreationLink); }
public BlogProviderAccountWizardDescriptionFromXml(string wizardDocumentPath) { // load the xml document XmlDocument wizardDocument = new XmlDocument(); wizardDocument.Load(wizardDocumentPath); // custom account wizard node XmlNode customAccountWizardNode = wizardDocument.SelectSingleNode("//customAccountWizard"); if (customAccountWizardNode == null) throw new Exception("Required root element customAccountWizard not specified"); // service name string serviceName = NodeText(customAccountWizardNode.SelectSingleNode("serviceName")); if (serviceName == String.Empty) throw new Exception("Required element serviceName is not specified or empty"); // welcome page is optional BlogProviderWelcomePage welcomePage = null; string welcomePageCaption = NodeText(customAccountWizardNode.SelectSingleNode("welcomePage/caption")); string welcomePageText = NodeText(customAccountWizardNode.SelectSingleNode("welcomePage/text")); if (welcomePageCaption != String.Empty && welcomePageText != String.Empty) welcomePage = new BlogProviderWelcomePage(welcomePageCaption, welcomePageText); // account creation link is optional BlogProviderAccountCreationLink accountCreationLink = null; string imagePath = NodeText(customAccountWizardNode.SelectSingleNode("accountCreationLink/imagePath")); if (imagePath != String.Empty) { if (!Path.IsPathRooted(imagePath)) imagePath = Path.Combine(Path.GetDirectoryName(wizardDocumentPath), imagePath); } string caption = NodeText(customAccountWizardNode.SelectSingleNode("accountCreationLink/caption")); string link = NodeText(customAccountWizardNode.SelectSingleNode("accountCreationLink/link")); if (imagePath != String.Empty && caption != String.Empty && link != String.Empty) accountCreationLink = new BlogProviderAccountCreationLinkFromFile(imagePath, caption, link); // initialize Init(serviceName, welcomePage, accountCreationLink); }