AddXNode() 공개 메소드

增加节点
public AddXNode ( string>.Dictionary value, System.Xml.Linq.XElement xElement, string xmlPath ) : string
value string>.Dictionary 需要修改的子节点的键值对
xElement System.Xml.Linq.XElement 所要修改的节点元素
xmlPath string xml文件的路径
리턴 string
예제 #1
0
 /// <summary>
 /// 执行添加项目操作
 /// </summary>
 /// <param name="childNodes">Projects节点下的节点集</param>
 /// <param name="property">Projects的节点属性集</param>
 /// <param name="xmlConfigPath">添加Projects的xml文件</param>
 /// <returns></returns>
 public string AddProject(Dictionary<string,string> childNodes  ,Dictionary<string,string> property,
     string xmlConfigPath)
 {
     XmlDao xmlDao = new XmlDao();
     string result = "";
     Dictionary<string,string> projectNode = new Dictionary<string, string>();
     projectNode.Add("Projects",null);
     XElement xElement = xmlDao.AddXElement(projectNode, property, xmlConfigPath);
     result = xmlDao.AddXNode(childNodes, xElement, xmlConfigPath);
     return result;
 }
예제 #2
0
 /// <summary>
 /// 存储Log(按版本号增加Log节点
 /// </summary>
 /// <param name="value">需要修改的子节点的键值对</param>
 /// <param name="property">需要筛选的属性值的键值对</param>
 /// <param name="xmlPath">xml文件的路径</param>
 /// <param name="nodePath">节点的路径</param>
 /// <returns></returns>
 public string SaveLog(ProjectInfo projectInfo, Dictionary<string, string> property, string xmlPath,
     string nodePath)
 {
     XmlDao xmlDao = new XmlDao();
     var logInfo = new Dictionary<string,string>();
     var logProperty = new Dictionary<string,string>();
     logInfo.Add("Log",projectInfo.Log);
     logProperty.Add("Revision",projectInfo.Revision);
     logProperty.Add("Result",projectInfo.Result);
     logProperty.Add("Time",DateTime.Now.ToString());
     string result = "";
     XElement xElement = xmlDao.SelectOneXElement(property, xmlPath, nodePath);
     xmlDao.AddXNode(logInfo, xElement, xmlPath);
     xElement = xmlDao.SelectOneXElement(property, xmlPath, nodePath);
     result = xmlDao.XNodeAttributes(logProperty, xElement.Elements("Log").Last(), xmlPath);
     return result;
 }