Exemple #1
0
        public void Load(XmlReader reader)
        {
            var state = new LoadState();

            while (reader.Read())
            {
                switch (reader.NodeType)
                {
                case XmlNodeType.Element:
                {
                    bool   empty = reader.IsEmptyElement;
                    string name  = reader.Name;
                    state.Push(name);
                    ReadAttrs(reader);
                    if (empty)
                    {
                        state.Pop();
                    }
                }
                break;

                case XmlNodeType.Text:
                    this[state.Key] = reader.Value;
                    break;

                case XmlNodeType.EndElement:
                    state.Pop();
                    break;
                }
            }
        }