/// <summary> /// 实体属性映射 Xml 属性名称 /// </summary> /// <param name="name">Xml 属性名</param> /// <param name="nameType">属性名类型</param> public XmlTAttribute(string name, XmlTEnum nameType = XmlTEnum.Attribute) { this.name = name; this.nameType = nameType; }
private static void SetXmlNodeAttribute(XmlNode xmlNode, string attributeName, string attributeValue, XmlDocument xmlDocument, XmlTEnum xmlEnum = XmlTEnum.Attribute) { if (xmlEnum == XmlTEnum.Attribute) { if (xmlNode.Attributes[attributeName] != null) { xmlNode.Attributes[attributeName].Value = attributeValue; } else { XmlAttribute attribute = xmlDocument.CreateAttribute(attributeName); attribute.Value = attributeValue; xmlNode.Attributes.Append(attribute); } } else { xmlNode.InnerText = attributeValue; } }