private XmlDocument GetDefinitionDocument() { var doc = new XmlDocument(); if (tvDefinition.Nodes.Count > 0) { XmlNode rootNode = doc.CreateElement("root"); doc.AppendChild(rootNode); TreeNodeHelper.AddXmlNode(tvDefinition.Nodes[0], rootNode); var xmlbody = doc.SelectSingleNode("root/ShuffleDefinition").OuterXml; doc.LoadXml(xmlbody); } return(doc); }