Exemplo n.º 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));
            }
        }
Exemplo n.º 2
0
        public virtual string substringData(int offset, int count)
        {
            if (offset < 0 || count < 0 || offset > XmlCharacterData.Length)
            {
                DOMException.Throw(ExceptionCode.IndexOutOfBounds);
                return(null);
            }

            return(XmlCharacterData.Substring(offset, count));
        }