InsertBefore() публичный Метод

public InsertBefore ( ) : XmlWriter
Результат System.Xml.XmlWriter
Пример #1
0
        public virtual XmlWriter PrependChild()
        {
            XPathNavigator nav = Clone();

            if (nav.MoveToFirstChild())
            {
                return(nav.InsertBefore());
            }
            else
            {
                return(AppendChild());
            }
        }
Пример #2
0
        public virtual XmlWriter InsertAfter()
        {
            switch (NodeType)
            {
            case XPathNodeType.Root:
            case XPathNodeType.Attribute:
            case XPathNodeType.Namespace:
                throw new InvalidOperationException(String.Format("Insertion after {0} is not allowed.", NodeType));
            }
            XPathNavigator nav = Clone();

            if (nav.MoveToNext())
            {
                return(nav.InsertBefore());
            }
            else if (nav.MoveToParent())
            {
                return(nav.AppendChild());
            }
            else
            {
                throw new InvalidOperationException("Could not move to parent to insert sibling node");
            }
        }