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)); } }
/// <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); }
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); }