/*private static void ReadBit(XmlReader reader)
         * {
         *  string name = "Unknown";
         *
         *  if (reader.MoveToAttribute("name"))
         *      name = reader.Value;
         *  if (!reader.MoveToAttribute("index"))
         *      throw new ArgumentException("Bit definitions must have an index." + PositionInfo(reader));
         *  int index = ParseInt(reader.Value);
         *
         *  layout.VisitBit(name, index);
         * }*/

        private void ReadOptions(XmlReader reader, string name, BasicFieldType type)
        {
            XmlReader subtree = reader.ReadSubtree();

            var enumLayout = new EnumLayout(name, type);

            subtree.ReadStartElement();
            while (subtree.ReadToNextSibling("option"))
            {
                enumLayout.Add(ReadOption(subtree));
            }

            _results.Layout.Add(new EnumTagLayoutField(name, enumLayout));
        }
        /*private static void ReadBit(XmlReader reader)
        {
            string name = "Unknown";

            if (reader.MoveToAttribute("name"))
                name = reader.Value;
            if (!reader.MoveToAttribute("index"))
                throw new ArgumentException("Bit definitions must have an index." + PositionInfo(reader));
            int index = ParseInt(reader.Value);

            layout.VisitBit(name, index);
        }*/

        private void ReadOptions(XmlReader reader, string name, BasicFieldType type)
        {
            XmlReader subtree = reader.ReadSubtree();

            var enumLayout = new EnumLayout(name, type);
            subtree.ReadStartElement();
            while (subtree.ReadToNextSibling("option"))
                enumLayout.Add(ReadOption(subtree));

            _results.Layout.Add(new EnumTagLayoutField(name, enumLayout));
        }