C#操作Xml通用工具类
using System;
using System.Xml;
namespace WLERP.Common.Util
{
/// <summary>
/// Xml 操作工具类
/// </summary>
public sealed class XmlUtil
{
private XmlUtil() { }
/// <summary>
/// 创建节点
/// </summary>
/// <param name="node"></param>
/// <param name="newElementName"></param>
/// <returns></returns>
public static XmlNode AppendElement(XmlNode node, string newElementName)
{
return AppendElement(node, newElementName, null);
}
/// <summary>
/// 创建节点
/// </summary>
/// <param name="node"></param>
/// <param name="newElementName"></param>
/// <param name="innerValue"></param>
/// <returns></returns>
public static XmlNode AppendElement(XmlNode node, string newElementName, string innerValue)
{
XmlNode oNode;
if (node is XmlDocument)
{
oNode = node.AppendChild(((XmlDocument)node).CreateElement(newElementName));
}
else
{
oNode = node.AppendChild(node.OwnerDocument.CreateElement(newElementName));
}
&
补充:软件开发 , C# ,