public override void Visit(CompositeBase element)
 {
     if (element.IsLeaf)
     {
         if (_items.ContainsKey(element.Name))
         {
             throw new ApplicationException(string.Format("NodeNameValueVisitor duplicate name error adding {0}/{1}",
                                                          element.ParentPath(), element.Name));
         }
         _items.Add(element.Name, element.Value);
     }
     else
     {
         foreach (CompositeBase c in (Composite)element)
         {
             if (c.IsLeaf)
             {
                 c.Accept(this);
             }
         }
     }
 }
示例#2
0
        /// <summary>
        /// Visits the specified element.
        /// </summary>
        /// <param name="element">The element.</param>
        public override void Visit(CompositeBase element)
        {
            if (element.IsLeaf)
            {
                // process this
                var name = element.ParentPath();
                // we want the root node to be implicit
                // this is for CALL roots only should be
                // subclassed to the FnsDomain?
                if (name.StartsWith("CALL:"))
                {
                    name = name.Remove(0, 5);
                }

                _collection.Add(name, element.Value);
            }
            else
            {
                foreach (CompositeBase c in (Composite)element)
                {
                    c.Accept(this);
                }
            }
        }