The following program produces output with line wrapped inside xml entity.
Tidy tidy = new Tidy();
tidy.setRawOut(true);
tidy.setAsciiChars(true);
tidy.setFixBackslash(true);
tidy.setHideComments(true);
tidy.setXHTML(true);
tidy.setInputEncoding("UTF-8");
tidy.setOutputEncoding("UTF-8");
tidy.setForceOutput(true);
tidy.setWraplen(10);
tidy.setErrout(new PrintWriter(new ByteArrayOutputStream(), false));
String source ="<html><body><div>1234567…<</div></body></html>";
ByteArrayInputStream bais = new ByteArrayInputStream(source.getBytes("UTF-8"));
Writer stringWriter = new StringWriter();
tidy.parse(bais, stringWriter);
System.out.println(stringWriter.toString());
This is the output:
<meta name="generator" content="HTML Tidy for Java (vers. 2009-12-01), see jtidy.sourceforge.net"> <title> </title>