Beispiel #1
0
        internal void SetReferencedEntityContent()
        {
            if (FirstChild != null)
            {
                return;
            }

            if (OwnerDocument.DocumentType == null)
            {
                return;
            }

            XmlEntity ent = Entity;

            if (ent == null)
            {
                InsertBefore(OwnerDocument.CreateTextNode(String.Empty), null, false, true);
            }
            else
            {
                for (int i = 0; i < ent.ChildNodes.Count; i++)
                {
                    InsertBefore(ent.ChildNodes [i].CloneNode(true), null, false, true);
                }
            }
        }
Beispiel #2
0
        public virtual XmlText SplitText(int offset)
        {
            XmlText next = OwnerDocument.CreateTextNode(this.Data.Substring(offset));

            DeleteData(offset, Data.Length - offset);
            this.ParentNode.InsertAfter(next, this);
            return(next);
        }
Beispiel #3
0
        // Split this node in two.
        public virtual XmlText SplitText(int offset)
        {
            int length = Length;

            if (offset < 0)
            {
                offset = 0;
            }
            else if (offset > length)
            {
                offset = length;
            }
            String  data = Data;
            XmlText node;

            node = OwnerDocument.CreateTextNode(data.Substring(offset));
            Data = data.Substring(0, offset);
            parent.InsertAfter(node, this);
            return(node);
        }
        public override XmlNode AppendChild(XmlNode newChild)
        {
            try
            {
#if OUTXML_CACHE
                outerXMLCache = null;
#endif
                if (newChild.OwnerDocument != OwnerDocument)
                {
                    if (newChild.NodeType == XmlNodeType.Text)
                    {
                        newChild = OwnerDocument.CreateTextNode(newChild.InnerText);
                    }
                }
                return(base.AppendChild(newChild));
            }
            catch (Exception e)
            {
                writeToLog("ERROR: newnode.AppendChild " + e);
                return(null);
            }
        }
Beispiel #5
0
        // Splits the node into two nodes at the specified offset, keeping
        // both in the tree as siblings.
        public virtual XmlText SplitText(int offset)
        {
            XmlNode parentNode = this.ParentNode;
            int     length     = this.Length;

            if (offset > length)
            {
                throw new ArgumentOutOfRangeException(nameof(offset));
            }
            //if the text node is out of the living tree, throw exception.
            if (parentNode == null)
            {
                throw new InvalidOperationException(SR.Xdom_TextNode_SplitText);
            }

            int    count     = length - offset;
            string splitData = Substring(offset, count);

            DeleteData(offset, count);
            XmlText newTextNode = OwnerDocument.CreateTextNode(splitData);

            parentNode.InsertAfter(newTextNode, this);
            return(newTextNode);
        }
Beispiel #6
0
        public override XmlNode CloneNode(bool deep)
        {
            XmlText newText = OwnerDocument.CreateTextNode(Data);

            return(newText);
        }
Beispiel #7
0
 // Creates a duplicate of this node.
 public override XmlNode CloneNode(bool deep)
 {
     Debug.Assert(OwnerDocument != null);
     return(OwnerDocument.CreateTextNode(Data));
 }
Beispiel #8
0
 // Clone this node.
 public override XmlNode CloneNode(bool deep)
 {
     return(OwnerDocument.CreateTextNode(Data));
 }