public static void XMLCreateTag(string Segment, string Identify) { if (Identify.Equals("EDI")) { EdiNode = doc.CreateElement("EDI"); } if (Identify.Equals("MSG")) { MsgNode = doc.CreateElement("MSG"); } if (Identify.Equals("CreateNode")) { FirstSegmentNode = doc.CreateElement(Segment); } if (Identify.Equals("SplitedNode")) { SplitedNode = doc.CreateElement(Segment); } if (Identify.Equals("TextNode")) { SplitedNode.AppendChild(doc.CreateTextNode(Segment)); FirstSegmentNode.AppendChild(SplitedNode); } if (Identify.Equals("append-CreateNode")) { MsgNode.AppendChild(FirstSegmentNode); } if (Identify.Equals("append-MSG")) { EdiNode.AppendChild(MsgNode); } if (Identify.Equals("append-EDI")) { doc.AppendChild(EdiNode); } }