public void SetCustomAttribute(string Key, string Value) { try { if (!Convert.ToBoolean(XmlNode.Attributes.GetNamedItem(Key) == null)) { if (Value == null) { XmlNode.Attributes.Remove((XmlAttribute)XmlNode.Attributes.GetNamedItem(Key)); } else { XmlNode.Attributes.GetNamedItem(Key).Value = Value; } } else if (Value != null) { XmlAttribute objAttr = XMLDoc.CreateAttribute(Key); objAttr.Value = Value; XmlNode.Attributes.Append(objAttr); } } catch (Exception ex) { throw (ex); } }
public void SetCustomAttribute(string key, string value) { try { if ((XmlNode.Attributes.GetNamedItem(key) != null)) { if (value == null) { XmlNode.Attributes.Remove((XmlAttribute)XmlNode.Attributes.GetNamedItem(key)); } else { XmlNode.Attributes.GetNamedItem(key).Value = value; } } else if ((value != null)) { System.Xml.XmlAttribute objAttr = XMLDoc.CreateAttribute(key); objAttr.Value = value; XmlNode.Attributes.Append(objAttr); } } catch (Exception ex) { throw ex; } }