示例#1
0
        private void CloseWithReplaceToFollowingSibling()
        {
            XmlNode?parent = _start.ParentNode;

            if (parent == null)
            {
                throw new InvalidOperationException(SR.Xpn_MissingParent);
            }

            if (_start != _end)
            {
                if (!DocumentXPathNavigator.IsFollowingSibling(_start, _end))
                {
                    throw new InvalidOperationException(SR.Xpn_BadPosition);
                }
                if (_start.IsReadOnly)
                {
                    throw new InvalidOperationException(SR.Xdom_Node_Modify_ReadOnly);
                }

                DocumentXPathNavigator.DeleteToFollowingSibling(_start.NextSibling !, _end);
            }

            XmlNode fragment0 = _fragment[0];

            parent.ReplaceChild(fragment0, _start);
            for (int i = _fragment.Count - 1; i >= 1; i--)
            {
                parent.InsertAfter(_fragment[i], fragment0);
            }

            _navigator !.ResetPosition(fragment0);
        }
        private void CloseWithReplaceToFollowingSibling()
        {
            XmlNode parentNode = this.start.ParentNode;

            if (parentNode == null)
            {
                throw new InvalidOperationException(Res.GetString("Xpn_MissingParent"));
            }
            if (this.start != this.end)
            {
                if (!DocumentXPathNavigator.IsFollowingSibling(this.start, this.end))
                {
                    throw new InvalidOperationException(Res.GetString("Xpn_BadPosition"));
                }
                if (this.start.IsReadOnly)
                {
                    throw new InvalidOperationException(Res.GetString("Xdom_Node_Modify_ReadOnly"));
                }
                DocumentXPathNavigator.DeleteToFollowingSibling(this.start.NextSibling, this.end);
            }
            XmlNode newChild = this.fragment[0];

            parentNode.ReplaceChild(newChild, this.start);
            for (int i = this.fragment.Count - 1; i >= 1; i--)
            {
                parentNode.InsertAfter(this.fragment[i], newChild);
            }
            this.navigator.ResetPosition(newChild);
        }
        private void CloseWithReplaceToFollowingSibling()
        {
            XmlNode parent = start.ParentNode;

            if (parent == null)
            {
                throw new InvalidOperationException(Res.GetString(Res.Xpn_MissingParent));
            }
            if (start != end)
            {
                if (!DocumentXPathNavigator.IsFollowingSibling(start, end))
                {
                    throw new InvalidOperationException(Res.GetString(Res.Xpn_BadPosition));
                }
                if (start.IsReadOnly)
                {
                    throw new InvalidOperationException(Res.GetString(Res.Xdom_Node_Modify_ReadOnly));
                }
                DocumentXPathNavigator.DeleteToFollowingSibling(start.NextSibling, end);
            }
            XmlNode fragment0 = fragment[0];

            parent.ReplaceChild(fragment0, start);
            for (int i = fragment.Count - 1; i >= 1; i--)
            {
                parent.InsertAfter(fragment[i], fragment0);
            }
            navigator.ResetPosition(fragment0);
        }
 public override bool MoveNext()
 {
     if (this.CurrentPosition == 0)
     {
         DocumentXPathNavigator current = (DocumentXPathNavigator)this.Current;
         XmlNode underlyingObject       = (XmlNode)current.UnderlyingObject;
         if ((underlyingObject.NodeType == XmlNodeType.Element) && this.Match(underlyingObject))
         {
             base.SetPosition(1);
             return(true);
         }
     }
     return(base.MoveNext());
 }
 internal DocumentXPathNodeIterator_AllElemChildren_AndSelf(DocumentXPathNavigator nav) : base(nav)
 {
 }
 internal DocumentXPathNodeIterator_ElemChildren(DocumentXPathNavigator nav, string localNameAtom, string nsAtom) : base(nav)
 {
     this.localNameAtom = localNameAtom;
     this.nsAtom        = nsAtom;
 }
示例#7
0
 internal DocumentXPathNodeIterator_ElemChildren_AndSelf(DocumentXPathNavigator nav, string localNameAtom, string nsAtom) : base(nav, localNameAtom, nsAtom)
 {
 }
 internal DocumentXPathNodeIterator_Empty(DocumentXPathNavigator nav)
 {
     this.nav = nav.Clone();
 }
示例#9
0
 internal DocumentXPathNodeIterator_ElemDescendants(DocumentXPathNodeIterator_ElemDescendants other)
 {
     this.nav      = (DocumentXPathNavigator)other.nav.Clone();
     this.level    = other.level;
     this.position = other.position;
 }
示例#10
0
 internal DocumentXPathNodeIterator_ElemDescendants(DocumentXPathNavigator nav)
 {
     this.nav      = (DocumentXPathNavigator)nav.Clone();
     this.level    = 0;
     this.position = 0;
 }