System.Xml.XPath.XPathNavigator.AppendChild C# (CSharp) Method

AppendChild() public method

public AppendChild ( XPathNavigator newChild ) : void
newChild XPathNavigator
return void
        public virtual void AppendChild(XPathNavigator newChild)
        {
            if (newChild == null)
            {
                throw new ArgumentNullException(nameof(newChild));
            }
            if (!IsValidChildType(newChild.NodeType))
            {
                throw new InvalidOperationException(SR.Xpn_BadPosition);
            }
            XmlReader reader = newChild.CreateReader();
            AppendChild(reader);
        }

Same methods

XPathNavigator::AppendChild ( ) : XmlWriter
XPathNavigator::AppendChild ( XmlReader newChild ) : void
XPathNavigator::AppendChild ( string newChild ) : void

Usage Example

        private static bool ProcessItemGroupNode(XPathNavigator nav)
        {
            try
            {
                if (nav.MoveToChild("StyleCopTreatErrorsAsWarnings", "http://schemas.microsoft.com/developer/msbuild/2003"))
                {
                    if (nav.Value == "false")
                    {
                        nav.ReplaceSelf("<StyleCopTreatErrorsAsWarnings>true</StyleCopTreatErrorsAsWarnings>");
                    }
                    else
                    {
                        nav.ReplaceSelf("<StyleCopTreatErrorsAsWarnings>false</StyleCopTreatErrorsAsWarnings>");
                    }
                }
                else
                {
                    nav.AppendChild("<StyleCopTreatErrorsAsWarnings>true</StyleCopTreatErrorsAsWarnings>");
                }

                return true;
            }
            catch
            {
                return false;
            }
        }
All Usage Examples Of System.Xml.XPath.XPathNavigator::AppendChild