读取xml文件

 1 string filePath = string.Format(System.Web.HttpContext.Current.Server.MapPath("~/XML/PostConfig/{0}.xml"), postId);
 2                         
 3                         if (System.IO.File.Exists(filePath))
 4                         {
 5                             #region 读取xml
 6                             //XmlDocument xmlDoc = new XmlDocument();
 7                             //xmlDoc.Load(filePath);
 8                             //System.Xml.XmlNodeList xnl = xmlDoc.SelectSingleNode("PostConfigInfo").ChildNodes;
 9 
10                             //foreach (XmlNode xn in xnl)
11                             //{
12                             //    XmlElement xe = (XmlElement)xn;
13                             //    defaultHomeUrl = xe.GetAttribute("templateUrl").ToString();
14                             //    defaultTheme = xe.GetAttribute("themeName").ToString();
15                             //}
16                             #endregion
17
1 <PostConfigInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" id="0" postGuid="" postName="11" displayName="222" departmentGuid="" departmentName="">
2   <ThemeTemplateInfo recordNum="UTM-201703140001" disaplyName="选项卡门户" englishName="HXProtal" themeID="4" themeLanguage="en" themeName="default" templateID="9" templateLanguage="en" templateName="Foreign.aspx" themeDisaplyName="Blue" templateUrl="Foreign" navUrl="Controls/NAV/CommonNavControl.ascx">

这种方式不可取?

收藏
关注
评论
原文地址:https://www.cnblogs.com/yidengbone/p/6861638.html