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

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 ; }
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 .
