示例#1
0
        public Parts.Menu ParseXmlDocument(XmlDocument xDoc)
        {
            XmlNode root = xDoc.ChildNodes[0];

            if (root.Name == "xml")
            {
                root = xDoc.ChildNodes[1];
            }
            if (root.Name != "menu")
            {
                throw new XmlException("First child node must be of type 'menu'");
            }

            Parts.Menu menu = ParseMenuNode(root);

            return(menu);
        }
示例#2
0
        private Parts.Menu ParseMenuNode(XmlNode xNode)
        {
            var menu = new Parts.Menu();

            menu.id = xNode.Attributes["id"].Value;

            foreach (XmlNode node in xNode.ChildNodes)
            {
                if (node.Name == "variable")
                {
                    menu.variables.Add(ParseVariableNode(node));
                }
                if (node.Name == "entry")
                {
                    menu.entries.Add(ParseEntryNode(node));
                }
            }

            return(menu);
        }
示例#3
0
        private Parts.Menu ParseMenuNode(XmlNode xNode)
        {
            var menu = new Parts.Menu();

            menu.id = xNode.Attributes["id"].Value;

            foreach (XmlNode node in xNode.ChildNodes)
            {
                if (node.Name == "variable")
                {
                    menu.variables.Add(ParseVariableNode(node));
                }
                if (node.Name == "entry")
                {
                    menu.entries.Add(ParseEntryNode(node));
                }
            }

            return menu;
        }