public static System.Xml.XmlDocument GenerateTree(string startingNodeId, TreeData.TreeDataTableDataTable dt)
        {
            XmlDocument xml             = new XmlDocument();
            string      rootDescription = string.Empty;
            string      rootNote        = string.Empty;

            if (dt.Select(string.Format("nodeID='{0}'", startingNodeId)).Length > 0)
            {
                rootDescription = ((TreeData.TreeDataTableRow)dt.Select(string.Format("nodeID='{0}'", startingNodeId))[0]).nodeDescription;
                rootNote        = ((TreeData.TreeDataTableRow)dt.Select(string.Format("nodeID='{0}'", startingNodeId))[0]).nodeNote;
            }

            XmlNode RootNode = GetXMLNode(xml, startingNodeId, rootDescription, rootNote);

            xml.AppendChild(RootNode);
            BuildTree(xml, dt, RootNode, 0);

            dt.Dispose();
            dt = null;

            return(xml);
        }
        /// <summary>
        /// convert the datatable to an XML document
        /// </summary>
        /// <param name="oNode"></param>
        /// <param name="y"></param>
        private static void BuildTree(XmlDocument xml, TreeData.TreeDataTableDataTable dtTree, XmlNode oNode, int y)
        {
            XmlNode childNode = null;

            //has children
            foreach (TreeData.TreeDataTableRow childRow in dtTree.Select(
                         string.Format("parentNodeID='{0}'", oNode.Attributes["nodeID"].InnerText)))
            {
                //for each child node call this function again
                childNode = GetXMLNode(xml, childRow.nodeID, childRow.nodeDescription, childRow.nodeNote);
                oNode.AppendChild(childNode);
                BuildTree(xml, dtTree, childNode, y + 1);
            }
        }