Beispiel #1
0
        private XmlLinkedNode _lastChild; // == this for empty elements otherwise it is the last child

        internal XmlElement(XmlName name, bool empty, XmlDocument doc) : base(doc)
        {
            Debug.Assert(name != null);
            this.parentNode = null;
            if (!doc.IsLoading)
            {
                XmlDocument.CheckName(name.Prefix);
                XmlDocument.CheckName(name.LocalName);
            }
            if (name.LocalName.Length == 0)
            {
                throw new ArgumentException(ResXml.Xdom_Empty_LocalName);
            }
            _name = name;
            if (empty)
            {
                _lastChild = this;
            }
        }
Beispiel #2
0
        //the function is provided only at Load time to speed up Load process
        internal override XmlNode AppendChildForLoad(XmlNode newChild, XmlDocument doc)
        {
            XmlNodeChangedEventArgs args = doc.GetInsertEventArgsForLoad(newChild, this);

            if (args != null)
            {
                doc.BeforeEvent(args);
            }

            XmlLinkedNode newNode = (XmlLinkedNode)newChild;

            if (_lastChild == null ||
                _lastChild == this)
            {                           // if LastNode == null
                newNode.next = newNode;
                _lastChild   = newNode; // LastNode = newNode;
                newNode.SetParentForLoad(this);
            }
            else
            {
                XmlLinkedNode refNode = _lastChild; // refNode = LastNode;
                newNode.next = refNode.next;
                refNode.next = newNode;
                _lastChild   = newNode; // LastNode = newNode;
                if (refNode.IsText &&
                    newNode.IsText)
                {
                    NestTextNodes(refNode, newNode);
                }
                else
                {
                    newNode.SetParentForLoad(this);
                }
            }

            if (args != null)
            {
                doc.AfterEvent(args);
            }

            return(newNode);
        }
Beispiel #3
0
 internal XmlLinkedNode(XmlDocument doc) : base(doc)
 {
     next = null;
 }
Beispiel #4
0
 internal XmlLinkedNode() : base()
 {
     next = null;
 }