* I am working on a assignment related to comparing two text content.* $ Following is sample output I am having :(Content can be of any type javascript html css .java .php .c# etc....) $ Following symbols denote : #~#~# - Content delete Start #~##~# -Content delete Stop #~~# - Content Insert Start #~~~# -Content Insert Stop ---------- Albert is a good boy <title>Compare this file *#~~# content #~~~#* with previous file contents.peter *#~#~# Content Removed #~##~#* *#~~#<center>#~~~# *#~#~# you are bad #~##~#* This is a text ---------- ---------- /* .diff-checker .diff-output .diff-line-modified .diff-chunk-inserted { background: #9F9; } .diff-checker .diff-output .diff-line-modified .diff-chunk-removed { background: #F88; } */ Based on above denotation,After Parsing. I have following two versions which I want to display in Tabular format by applying above style in modified contents: ---------- Version 1 ---------- $ /* Albert is a good boy <title>Compare this file with previous file contents.peter <span class='diff-chunk-removed'> Content Removed </span>* *<span class='diff-chunk-removed'> </table> </span>* This is a text */ ---------- Version 2//Second version will highlight inserted content ---------- /* Albert is a good boy <title>Compare this file *<span class='diff-chunk-inserted'> content </span>* with previous file contents.peter *<span class='diff-chunk-inserted'> <center> </span>* This is a text */ I tried several ways to achieve the expected output by displaying the content in jsp or javascript in tabular format . But I failed to do so because I try to display the content as TEXT then mentioned style is not getting applied and when I try to display them as HTML then html text is been rendered on page. Following is block of javascript code I wrote to insert the data into table: /* var tr = table.insertRow(-1); var td1 = document.createElement('td'); td1.align='center'; td1.innerHTML = col1; var td2 = document.createElement('td'); td2.align='center'; td2.innerText = returnString; tr.appendChild(td1); tr.appendChild(td2); */ Thanks For Solution .
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)