public AbstractLattice(XmlNode modelXml)
        {
            if (modelXml != null)
            {
                _root = new AbstractTreeLatticeNode(modelXml.Name,AbstractTreeNodeType.Element);

                XmlNode x = modelXml.SelectSingleNode("text()");
                if (x != null)
                {
                    if (!String.IsNullOrEmpty(x.InnerText))
                    {
                        _root.addValue(x.InnerText);
                    }
                }

                foreach (XmlAttribute at in modelXml.Attributes)//read attributes
                {
                    AbstractTreeLatticeNode attnode = _root.addChild(at.Name, AbstractTreeNodeType.Attribute, -1);
                    attnode.Values.Add(at.Value);
                }

                foreach (XmlNode xn in modelXml.ChildNodes)
                    if (xn.NodeType != XmlNodeType.Text)
                        processXmlNodes(xn);

                prepare();
            }
        }
        /// <summary>
        /// Reads XML node and creates a tree lattice based on it.
        /// </summary>
        /// <param name="modelFile"></param>
        public void processXmlData(XmlNode x1)
        {
            //detach x1 from its parent
            XmlNode xnode = x1.Clone();

            _root = new AbstractTreeLatticeNode(xnode.Name,AbstractTreeNodeType.Element);
            //MessageBox.Show(Root.Name);

            XmlNode x = xnode.SelectSingleNode("text()");
            if (x != null)
            {
                if (!String.IsNullOrEmpty(x.InnerText))
                {
                    _root.addValue(x.InnerText);
                }
            }

            foreach (XmlAttribute at in xnode.Attributes)//read attributes
            {
                AbstractTreeLatticeNode attnode = _root.addChild(at.Name, AbstractTreeNodeType.Attribute, -1);
                attnode.Values.Add(at.Value);
            }

            foreach (XmlNode xn in xnode.ChildNodes)
                if (xn.NodeType != XmlNodeType.Text)
                    processXmlNodes(xn);
        }
        /// <summary>
        /// Reads XML model example file and creates a tree lattice based on it.
        /// </summary>
        /// <param name="modelFile"></param>
        public void processModelFile(String modelFile)
        {
            //Test = new Collection<AbstractTreeLatticeNode>();
            XmlDocument xdoc = new XmlDocument();
            xdoc.Load(modelFile);

            _root = new AbstractTreeLatticeNode(xdoc.DocumentElement.Name,AbstractTreeNodeType.Element);
            //MessageBox.Show(Root.Name);

            XmlNode x = xdoc.DocumentElement.SelectSingleNode("text()");
            if (x != null)
            {
                if (!String.IsNullOrEmpty(x.InnerText))
                {
                    _root.addValue(x.InnerText);
                }
            }

            foreach (XmlAttribute at in xdoc.DocumentElement.Attributes)//read attributes
            {
                AbstractTreeLatticeNode attnode = _root.addChild(at.Name, AbstractTreeNodeType.Attribute, -1);
                attnode.Values.Add(at.Value);
            }

            foreach (XmlNode xn in xdoc.DocumentElement.ChildNodes)
                if (xn.NodeType != XmlNodeType.Text)
                    processXmlNodes(xn);

            //MessageBox.Show("lattice should now be complete\n\n"+ Root.printTreeNode());
            //Test.Add(_root);
        }