GetId() private method

private GetId ( ) : string
return string
Esempio n. 1
0
        public HtmlNode RemoveChild(HtmlNode oldChild)
        {
            if (oldChild == null)
            {
                throw new ArgumentNullException(nameof(oldChild));
            }
            int index = -1;

            if (this._childnodes != null)
            {
                index = this._childnodes[oldChild];
            }
            if (index == -1)
            {
                throw new ArgumentException(HtmlDocument.HtmlExceptionRefNotChild);
            }
            if (this._childnodes != null)
            {
                this._childnodes.Remove(index);
            }
            this._ownerdocument.SetIdForNode((HtmlNode)null, oldChild.GetId());
            this._outerchanged = true;
            this._innerchanged = true;
            return(oldChild);
        }
Esempio n. 2
0
        public HtmlNode ReplaceChild(HtmlNode newChild, HtmlNode oldChild)
        {
            if (newChild == null)
            {
                return(RemoveChild(oldChild));
            }
            if (oldChild == null)
            {
                return(AppendChild(newChild));
            }
            int index = -1;

            if (_childnodes != null)
            {
                index = _childnodes[oldChild];
            }
            if (index == -1)
            {
                throw new ArgumentException(HtmlDocument.HtmlExceptionRefNotChild);
            }
            if (_childnodes != null)
            {
                _childnodes.Replace(index, newChild);
            }
            _ownerdocument.SetIdForNode(null, oldChild.GetId());
            _ownerdocument.SetIdForNode(newChild, newChild.GetId());
            _outerchanged = true;
            _innerchanged = true;
            return(newChild);
        }
Esempio n. 3
0
 public HtmlNode InsertBefore(HtmlNode newChild, HtmlNode refChild)
 {
     if (newChild == null)
     {
         throw new ArgumentNullException("newChild");
     }
     if (refChild == null)
     {
         return(AppendChild(newChild));
     }
     if (newChild != refChild)
     {
         int index = -1;
         if (_childnodes != null)
         {
             index = _childnodes[refChild];
         }
         if (index == -1)
         {
             throw new ArgumentException(HtmlDocument.HtmlExceptionRefNotChild);
         }
         if (_childnodes != null)
         {
             _childnodes.Insert(index, newChild);
         }
         _ownerdocument.SetIdForNode(newChild, newChild.GetId());
         _outerchanged = true;
         _innerchanged = true;
     }
     return(newChild);
 }
Esempio n. 4
0
        public HtmlNode InsertBefore(HtmlNode newChild, HtmlNode refChild)
        {
            if (newChild == null)
            {
                throw new ArgumentNullException(nameof(newChild));
            }
            if (refChild == null)
            {
                return(this.AppendChild(newChild));
            }
            if (newChild == refChild)
            {
                return(newChild);
            }
            int index = -1;

            if (this._childnodes != null)
            {
                index = this._childnodes[refChild];
            }
            if (index == -1)
            {
                throw new ArgumentException(HtmlDocument.HtmlExceptionRefNotChild);
            }
            if (this._childnodes != null)
            {
                this._childnodes.Insert(index, newChild);
            }
            this._ownerdocument.SetIdForNode(newChild, newChild.GetId());
            this._outerchanged = true;
            this._innerchanged = true;
            return(newChild);
        }
Esempio n. 5
0
 public HtmlNode PrependChild(HtmlNode newChild)
 {
     if (newChild == null)
     {
         throw new ArgumentNullException("newChild");
     }
     ChildNodes.Prepend(newChild);
     _ownerdocument.SetIdForNode(newChild, newChild.GetId());
     _outerchanged = true;
     _innerchanged = true;
     return(newChild);
 }
Esempio n. 6
0
 public HtmlNode AppendChild(HtmlNode newChild)
 {
     if (newChild == null)
     {
         throw new ArgumentNullException(nameof(newChild));
     }
     this.ChildNodes.Append(newChild);
     this._ownerdocument.SetIdForNode(newChild, newChild.GetId());
     this._outerchanged = true;
     this._innerchanged = true;
     return(newChild);
 }
        /// <summary>
        /// Adds the specified node to the end of the list of children of this node.
        /// </summary>
        /// <param name="newChild">The node to add. May not be null.</param>
        /// <returns>The node added.</returns>
        public HtmlNode AppendChild(HtmlNode newChild)
        {
            if (newChild == null)
            {
                throw new ArgumentNullException("newChild");
            }

            ChildNodes.Append(newChild);
            _ownerdocument.SetIdForNode(newChild, newChild.GetId());
            _outerchanged = true;
            _innerchanged = true;
            return newChild;
        }
        /// <summary>
        /// Replaces the child node oldChild with newChild node.
        /// </summary>
        /// <param name="newChild">The new node to put in the child list.</param>
        /// <param name="oldChild">The node being replaced in the list.</param>
        /// <returns>The node replaced.</returns>
        public HtmlNode ReplaceChild(HtmlNode newChild, HtmlNode oldChild)
        {
            if (newChild == null)
            {
                return RemoveChild(oldChild);
            }

            if (oldChild == null)
            {
                return AppendChild(newChild);
            }

            int index = -1;

            if (_childnodes != null)
            {
                index = _childnodes[oldChild];
            }

            if (index == -1)
            {
                throw new ArgumentException(HtmlDocument.HtmlExceptionRefNotChild);
            }

            if (_childnodes != null) _childnodes.Replace(index, newChild);

            _ownerdocument.SetIdForNode(null, oldChild.GetId());
            _ownerdocument.SetIdForNode(newChild, newChild.GetId());
            _outerchanged = true;
            _innerchanged = true;
            return newChild;
        }
        /// <summary>
        /// Inserts the specified node immediately before the specified reference node.
        /// </summary>
        /// <param name="newChild">The node to insert. May not be <c>null</c>.</param>
        /// <param name="refChild">The node that is the reference node. The newChild is placed before this node.</param>
        /// <returns>The node being inserted.</returns>
        public HtmlNode InsertBefore(HtmlNode newChild, HtmlNode refChild)
        {
            if (newChild == null)
            {
                throw new ArgumentNullException("newChild");
            }

            if (refChild == null)
            {
                return AppendChild(newChild);
            }

            if (newChild == refChild)
            {
                return newChild;
            }

            int index = -1;

            if (_childnodes != null)
            {
                index = _childnodes[refChild];
            }

            if (index == -1)
            {
                throw new ArgumentException(HtmlDocument.HtmlExceptionRefNotChild);
            }

            if (_childnodes != null) _childnodes.Insert(index, newChild);

            _ownerdocument.SetIdForNode(newChild, newChild.GetId());
            _outerchanged = true;
            _innerchanged = true;
            return newChild;
        }
Esempio n. 10
0
        /// <summary>
        /// Removes the specified child node.
        /// </summary>
        /// <param name="oldChild">The node being removed. May not be <c>null</c>.</param>
        /// <returns>The node removed.</returns>
        public HtmlNode RemoveChild(HtmlNode oldChild)
        {
            if (oldChild == null)
            {
                throw new ArgumentNullException("oldChild");
            }

            int index = -1;

            if (_childnodes != null)
            {
                index = _childnodes[oldChild];
            }

            if (index == -1)
            {
                throw new ArgumentException(HtmlDocument.HtmlExceptionRefNotChild);
            }

            if (_childnodes != null)
                _childnodes.Remove(index);

            _ownerdocument.SetIdForNode(null, oldChild.GetId());
            SetChanged();
            return oldChild;
        }
Esempio n. 11
0
 /// <summary>
 /// Adds the specified node to the beginning of the list of children of this node.
 /// </summary>
 /// <param name="newChild">The node to add. May not be <c>null</c>.</param>
 /// <returns>The node added.</returns>
 public HtmlNode PrependChild(HtmlNode newChild)
 {
     if (newChild == null)
     {
         throw new ArgumentNullException("newChild");
     }
     ChildNodes.Prepend(newChild);
     _ownerdocument.SetIdForNode(newChild, newChild.GetId());
     SetChanged();
     return newChild;
 }
Esempio n. 12
0
        /// <summary>
        /// Inserts the specified node immediately after the specified reference node.
        /// </summary>
        /// <param name="newChild">The node to insert. May not be <c>null</c>.</param>
        /// <param name="refChild">The node that is the reference node. The newNode is placed after the refNode.</param>
        /// <returns>The node being inserted.</returns>
        public HtmlNode InsertAfter(HtmlNode newChild, HtmlNode refChild)
        {
            if (newChild == null)
            {
                throw new ArgumentNullException("newChild");
            }

            if (refChild == null)
            {
                return PrependChild(newChild);
            }

            if (newChild == refChild)
            {
                return newChild;
            }

            int index = -1;

            if (_childnodes != null)
            {
                index = _childnodes[refChild];
            }
            if (index == -1)
            {
                throw new ArgumentException(HtmlDocument.HtmlExceptionRefNotChild);
            }

            if (_childnodes != null) _childnodes.Insert(index + 1, newChild);

            _ownerdocument.SetIdForNode(newChild, newChild.GetId());
            SetChanged();
            return newChild;
        }
Esempio n. 13
0
 /// <summary>
 /// Replaces the child node oldChild with newChild node.
 /// 
 /// </summary>
 /// <param name="newChild">The new node to put in the child list.</param><param name="oldChild">The node being replaced in the list.</param>
 /// <returns>
 /// The node replaced.
 /// </returns>
 public HtmlNode ReplaceChild(HtmlNode newChild, HtmlNode oldChild)
 {
   if (newChild == null)
     return this.RemoveChild(oldChild);
   if (oldChild == null)
     return this.AppendChild(newChild);
   int index = -1;
   if (this._childnodes != null)
     index = this._childnodes[oldChild];
   if (index == -1)
     throw new ArgumentException(HtmlDocument.HtmlExceptionRefNotChild);
   if (this._childnodes != null)
     this._childnodes.Replace(index, newChild);
   this._ownerdocument.SetIdForNode((HtmlNode) null, oldChild.GetId());
   this._ownerdocument.SetIdForNode(newChild, newChild.GetId());
   this._outerchanged = true;
   this._innerchanged = true;
   return newChild;
 }
Esempio n. 14
0
 /// <summary>
 /// Adds the specified node to the beginning of the list of children of this node.
 /// 
 /// </summary>
 /// <param name="newChild">The node to add. May not be <c>null</c>.</param>
 /// <returns>
 /// The node added.
 /// </returns>
 public HtmlNode PrependChild(HtmlNode newChild)
 {
   if (newChild == null)
     throw new ArgumentNullException("newChild");
   this.ChildNodes.Prepend(newChild);
   this._ownerdocument.SetIdForNode(newChild, newChild.GetId());
   this._outerchanged = true;
   this._innerchanged = true;
   return newChild;
 }
Esempio n. 15
0
 /// <summary>
 /// Inserts the specified node immediately after the specified reference node.
 /// 
 /// </summary>
 /// <param name="newChild">The node to insert. May not be <c>null</c>.</param><param name="refChild">The node that is the reference node. The newNode is placed after the refNode.</param>
 /// <returns>
 /// The node being inserted.
 /// </returns>
 public HtmlNode InsertAfter(HtmlNode newChild, HtmlNode refChild)
 {
   if (newChild == null)
     throw new ArgumentNullException("newChild");
   if (refChild == null)
     return this.PrependChild(newChild);
   if (newChild == refChild)
     return newChild;
   int num = -1;
   if (this._childnodes != null)
     num = this._childnodes[refChild];
   if (num == -1)
     throw new ArgumentException(HtmlDocument.HtmlExceptionRefNotChild);
   if (this._childnodes != null)
     this._childnodes.Insert(num + 1, newChild);
   this._ownerdocument.SetIdForNode(newChild, newChild.GetId());
   this._outerchanged = true;
   this._innerchanged = true;
   return newChild;
 }