public XmlNode exportXMLnode() { XmlDocument xmlDoc = new XmlDocument(); StringWriter stringWriter = new StringWriter(); XmlTextWriter xmlTextWriter = new XmlTextWriter(stringWriter); XmlNode rootNode = null; if (isNodeComment) { rootNode = xmlDoc.CreateComment(comment); xmlDoc.AppendChild(rootNode); return(rootNode); } rootNode = xmlDoc.CreateElement(dinType.ToString()); xmlDoc.AppendChild(rootNode); if (masterType == MasterTypes.IEC61850Client) { foreach (string attr in arrAttributes) { XmlAttribute attrName = xmlDoc.CreateAttribute(attr); attrName.Value = (string)this.GetType().GetProperty(attr).GetValue(this); rootNode.Attributes.Append(attrName); } XmlAttribute attr1 = xmlDoc.CreateAttribute("ResponseType"); attr1.Value = Iec61850DIResponseType.ToString(); rootNode.Attributes.Append(attr1); XmlAttribute attr2 = xmlDoc.CreateAttribute("Index"); attr2.Value = Iec61850DIIndex.ToString(); rootNode.Attributes.Append(attr2); XmlAttribute attrfc = xmlDoc.CreateAttribute("FC"); attrfc.Value = FC.ToString(); rootNode.Attributes.Append(attrfc); XmlAttribute attr3 = xmlDoc.CreateAttribute("SubIndex"); attr3.Value = SubIndex.ToString(); rootNode.Attributes.Append(attr3); XmlAttribute attr7 = xmlDoc.CreateAttribute("Description"); attr7.Value = Description.ToString(); rootNode.Attributes.Append(attr7); } else { //Namrata: 17/7/2017 //Create New Element in XML XmlNode Data = xmlDoc.CreateNode(XmlNodeType.Element, "Event", null); foreach (string attr in arrAttributes) { XmlAttribute attrName = xmlDoc.CreateAttribute(attr); attrName.Value = (string)this.GetType().GetProperty(attr).GetValue(this); rootNode.Attributes.Append(attrName); } //Namrata: 17/7/2017 if (masterType == MasterTypes.ADR) { foreach (string attr1 in arrAttributesEvents) { XmlAttribute attrName = xmlDoc.CreateAttribute(attr1); Data.Attributes.Append(attrName); attrName.Value = (string)this.GetType().GetProperty(attr1).GetValue(this); rootNode.AppendChild(Data); } } } return(rootNode); }