java - Inserting new line characters in a string which has html code in it -


My problem is that I have developed a tool that merge two HTML snippets (each snippet has its own & Lt; / html & gt; & lt;! DOCTYPE html & gt; tag) I combine them into a string and then save it as an output.html file which can be opened in the browser.

The problem is that the output is not HTML formatted and wrapping all the text / code in a single line.

The current output looks something like this: -

   & Lt; Title & gt; 1 ABCD & lt; / Title & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Header roll = "exis" & gt; & Lt; / Body & gt; & Lt; / Html & gt; & Lt ;! DOCTYPE html & gt; & Lt; Html xmlns = "http://www.w3.org/1999/xhtml" XML: lang = "en-US" lang = "en-america" ​​& gt; & Lt; Top & gt; & Lt; Meta charset = "UTF-8" /> & Lt; Title & gt; 1 efgh & lt; / Title & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Header roll = "mnp" & gt; & Lt; / Body & gt; & Lt; / Html & gt;   

I want to do it more

  & lt ;! DOCTYPE html & gt; & Lt; Html xmlns = "http: //www.w3.org/1999/xhtml" xml: lang = "en-US" lang = "en-US" & gt; & Lt; Head & gt; & Lt; Meta charset = "UTF-8" /> & Lt; Title & gt; 1 ABCD & lt; / Title & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Header roll = "exis" & gt; & Lt; / Body & gt; & Lt; / Html & gt; & Lt ;! DOCTYPE html & gt; & Lt; Html xmlns = "http://www.w3.org/1999/xhtml" xml: lang = "en-US" long = "N-US" & gt; & Lt; Head & gt; & Lt; Meta charset = "UTF-8" /> & Lt; Title & gt; 1 efgh & lt; / Title & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Header roll = "mnp" & gt; & Lt; / Body & gt; & Lt; / Html & gt;   

Any indication how to do this Please help me do not want to delete any tags, but I want to move the code to new lines.

thanks giant

JTD can be helpful for you, it's a clean of HTML Java version is

Once you have two clear documents, then it should be straight forward to trim extra tags and then merge them.

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

c# - Confused over DLL entry points (entry point not found exception) -