Example #1
0
        /// <summary>
        /// This method sets newArgument as the index-th argument of this element.
        /// If there is currently an index-th argument, it is replaced by newArgument.
        /// This frequently differs from setting the node at Node::childNodes().item(index),
        /// as qualifier elements and declare elements are not counted.
        /// </summary>
        public MathMLElement SetArgument(MathMLElement newArgument, int index)
        {
            XmlNode node = arguments.Item(index);

            if (node != null)
            {
                node = element.ReplaceChild(newArgument, node);
            }
            else if (index == arguments.Count + 1)
            {
                node = element.AppendChild(newArgument);
            }
            else
            {
                // this is bad, should throw some sort of exceptionb
            }
            return((MathMLElement)node);
        }