question: private Node traverseCharacterDataNode ( Node n , boolean isLeft , int how ) { String txtValue = n . getNodeValue ( ) ; String newNodeValue ; String oldNodeValue ; if ( isLeft ) { int offset = getStartOffset ( ) ; newNodeValue = txtValue . substring ( offset ) ; oldNodeValue = txtValue . substring ( 0 , offset ) ; } else { int offset = getEndOffset ( ) ; newNodeValue = txtValue . substring ( 0 , offset ) ; oldNodeValue = txtValue . substring ( offset ) ; } if ( how != CLONE_CONTENTS ) n . setNodeValue ( oldNodeValue ) ; if ( how == DELETE_CONTENTS ) return null ; Node newNode = n . cloneNode ( false ) ; newNode . setNodeValue ( newNodeValue ) ; return newNode ; }
target:  Utility method for traversing a node containing character data (either a Text, CDATASection, Comment or ProcessingInstruction node) that we know a-priori to be on a left or right boundary of the range. This method does not properly handle text nodes that contain both the start and end points of the range.