예제 #1
0
        public DOMText splitText(int offset)
        {
            if (offset < 0 || offset > this.dataLengthImpl)
            {
                return(null);
            }

            if (!IsAssociated)
            {
                return(CreateDOMText(dataImpl.Substring(offset)));
            }
            else if (XmlCharacterData is XmlText xmlText)
            {
                return((DOMText)Create(xmlText.SplitText(offset)));
            }
            else
            {
                // In case of XmlWhitespace and XmlSignificantWhitespace
                int    count     = this.dataLengthImpl - offset;
                string splitData = XmlCharacterData.Substring(offset, count);
                XmlCharacterData.DeleteData(offset, count);
                XmlText newTextNode = XmlCharacterData.OwnerDocument.CreateTextNode(splitData);
                XmlCharacterData.ParentNode.InsertAfter(newTextNode, XmlCharacterData);
                return((DOMText)Create(newTextNode));
            }
        }
예제 #2
0
        /// <summary>
        /// Removes a range of characters from the node.
        /// </summary>
        /// <param name="offset">The position within the string to start deleting.</param>
        /// <param name="count">The number of characters to delete.</param>
        /// <returns><B>True</B> or <B>false</B>.</returns>
        public virtual void deleteData(int offset, int count)
        {
            if (offset < 0 || count < 0 || offset > XmlCharacterData.Length)
            {
                DOMException.Throw(ExceptionCode.IndexOutOfBounds);
            }

            XmlCharacterData.DeleteData(offset, count);
        }
예제 #3
0
        public bool deleteData(int offset, int count)
        {
            if (offset < 0 || count < 0 || offset > XmlCharacterData.Length)
            {
                DOMException.Throw(ExceptionCode.IndexOutOfBounds);
                return(false);
            }

            XmlCharacterData.DeleteData(offset, count);
            return(true);
        }