private void printContentRange(Writer out,List content,int start,int end,int level,EclipseNamespaceStack namespaces) throws IOException {
  boolean firstNode;
  Object next;
  int first, index;
  index=start;
  while (index < end) {
    firstNode=(index == start) ? true : false;
    next=content.get(index);
    if ((next instanceof Text) || (next instanceof EntityRef)) {
      first=skipLeadingWhite(content,index);
      index=nextNonText(content,first);
      if (first < index) {
        if (!firstNode)         newline(out);
        indent(out,level);
        printTextRange(out,content,first,index);
      }
      continue;
    }
    if (!firstNode) {
      newline(out);
    }
    indent(out,level);
    if (next instanceof Comment) {
      printComment(out,(Comment)next);
    }
 else     if (next instanceof Element) {
      printElement(out,(Element)next,level,namespaces);
    }
 else     if (next instanceof ProcessingInstruction) {
      printProcessingInstruction(out,(ProcessingInstruction)next);
    }
 else {
    }
    index++;
  }
}

private void printContentRange ( Writer out , List content , int start , int end , int level , EclipseNamespaceStack namespaces ) throws IOException { boolean firstNode ; Object next ; int first , index ; index = start ; while ( index < end ) { firstNode = ( index == start ) ? true : false ; next = content . get ( index ) ; if ( ( next instanceof Text ) || ( next instanceof EntityRef ) ) { first = skipLeadingWhite ( content , index ) ; index = nextNonText ( content , first ) ; if ( first < index ) { if ( ! firstNode ) newline ( out ) ; indent ( out , level ) ; printTextRange ( out , content , first , index ) ; } continue ; } if ( ! firstNode ) { newline ( out ) ; } indent ( out , level ) ; if ( next instanceof Comment ) { printComment ( out , ( Comment ) next ) ; } else if ( next instanceof Element ) { printElement ( out , ( Element ) next , level , namespaces ) ; } else if ( next instanceof ProcessingInstruction ) { printProcessingInstruction ( out , ( ProcessingInstruction ) next ) ; } else { } index ++ ; } }
this will handle printing of content within a given range . the range to print is specified in typical java fashion ; the starting index is inclusive , while the ending index is exclusive .
