Wrapping in HTML

Hi All,

I have a requirement, where i want to wrap HTML content in my java code
according to some length.

Say for example:
----------------------------------------------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>tidy</title>
</head>
<body>
<p>
Thisisa paragraphwithasmallerline-height.<br
/>Thisisaparagraphwithasmallerline-height.<br />
Thisisaparagraphwithasmallerline-height.<br /><br />
Thisisaparagraphwithasmallerline-height.<br /><br />
</p>

</body>

</html>

----------------------------------------------------------------------------------------------------------------------------------------

Given the above input and length 5, i want following output.


----------------------------------------------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>tidy</title>
</head>
<body>
<p>
Thisi
sa pa
ragra
phwit
hasma
llerl
ine-h
eight
..<br />Thisi
sapar
agrap
hwith
asmal
lerli
ne-he
ight.<br />
Thisi
sapar
agrap
hwith
asmal
lerli
ne-he
ight.<br /><br />
Thisi
sapar
agrap
hwith
asmal
lerli
ne-he
ight.<br /><br />
</p>


</body>

</html>




----------------------------------------------------------------------------------------------------------------------------------------





-- 
Ashok R
Lead - Software Development
Verisign India Pvt Ltd.
Bengalooru.

Received on Friday, 6 January 2012 14:34:29 UTC