javascript – I want to merge two html content-ThrowExceptions

Exception or error:

I am trying to merge these two file. I am matching the content and merging but that is coming correctly. Tag should also be merged along with content.You can see start tag is in one other file and end tag is one in other file.

<p>
    <suggestion id=\"e87c7ef9bc864f08d8d93417eab96dbae:user-2\" suggestion-type=\"insertion\" type=\"start\">
    </suggestion>You should try first.
</p>
<p>
    <suggestion id=\"e87c7ef9bc864f08d8d93417eab96dbae:user-2\" suggestion-type=\"insertion\" type=\"end\"></suggestion>
    <suggestion id=\"ea911bad0aab85be4f1dcb47e96e8abf5:user-2\" suggestion-type=\"deletion\" type=\"start\">
    </suggestion>I have added first line.<suggestion id=\"ea911bad0aab85be4f1dcb47e96e8abf5:user-2\"
        suggestion-type=\"deletion\" type=\"end\"></suggestion>
</p>
<p>
    <suggestion id=\"ea6ce46e4407070c41d499fd1f6893c28:user-2\" suggestion-type=\"insertion\" type=\"start\">
    </suggestion>I am reviewer.<suggestion id=\"ea6ce46e4407070c41d499fd1f6893c28:user-2\" suggestion-type=\"insertion\"
        type=\"end\"></suggestion>
</p>
<p>Hello Azure!!!</p>
<p>I am Contributor.<suggestion id=\"eeb2304fa04e4376ac9005ac6dd60face:user-2\" suggestion-type=\"insertion\"
        type=\"start\"></suggestion> i know<suggestion id=\"eeb2304fa04e4376ac9005ac6dd60face:user-2\"
        suggestion-type=\"insertion\" type=\"end\"></suggestion>
</p>
<p>How Are you Approver.<suggestion id=\"e44472d837276fd35253cedb8fee29246:user-2\" suggestion-type=\"insertion\"
        type=\"start\"></suggestion> looks good<suggestion id=\"e44472d837276fd35253cedb8fee29246:user-2\"
        suggestion-type=\"insertion\" type=\"end\"></suggestion>
</p>
<p>Hello World!!!</p>
<p>I have addded this line also.</p>
<p>How are you.</p>
<p>let me add here.<suggestion id=\"ebbe8862a6231a71d4b16dcd64f2416d8:user-2\" suggestion-type=\"insertion\"
        type=\"start\"></suggestion>
</p>
<p>Last line will be added by me only.<suggestion id=\"ebbe8862a6231a71d4b16dcd64f2416d8:user-2\"
        suggestion-type=\"insertion\" type=\"end\"></suggestion>
</p>

second file is:

<p>
    <suggestion id=\"e2d3c034ae08418c7b15f1683de58888b:user-4\" suggestion-type=\"insertion\" type=\"start\">
    </suggestion>I have added first line.
</p>
<p>
    <suggestion id=\"e2d3c034ae08418c7b15f1683de58888b:user-4\" suggestion-type=\"insertion\" type=\"end\"></suggestion>
    <suggestion id=\"e4face02b3914dccc2324bba4d52aac1e:user-4\" suggestion-type=\"deletion\" type=\"start\">
    </suggestion>This is 2nd editor!!!<suggestion id=\"e4face02b3914dccc2324bba4d52aac1e:user-4\"
        suggestion-type=\"deletion\" type=\"end\"></suggestion>
</p>
<p>Hello Azure!!!<suggestion id=\"e95d6a3c3a63d7b2eb5b06ea52b485b0a:user-1\" suggestion-type=\"insertion\"
        type=\"start\"></suggestion>
</p>
<p>I am Contributor.<suggestion id=\"e95d6a3c3a63d7b2eb5b06ea52b485b0a:user-1\" suggestion-type=\"insertion\"
        type=\"end\"></suggestion>
</p>
<p>How Are you Approver.<suggestion id=\"e3bc0ec4a269b70115583dcf17ec5b699:user-1\" suggestion-type=\"insertion\"
        type=\"start\"></suggestion>
</p>
<p>I have added this line.<suggestion id=\"ef2fe67e8c0c5450666af23a1c7a7d474:user-4\" suggestion-type=\"insertion\"
        type=\"start\"></suggestion>
    <suggestion id=\"e3bc0ec4a269b70115583dcf17ec5b699:user-1\" suggestion-type=\"insertion\" type=\"end\"></suggestion>
</p>
<p>I think above line is incorrect.<suggestion id=\"ef2fe67e8c0c5450666af23a1c7a7d474:user-4\"
        suggestion-type=\"insertion\" type=\"end\"></suggestion>
</p>
<p>Hello World!!!<suggestion id=\"e251ecbbc7524ec1b6bbea03d99f5aa1e:user-4\" suggestion-type=\"insertion\"
        type=\"start\"></suggestion>
</p>
<p>I have addded this line also.<suggestion id=\"e251ecbbc7524ec1b6bbea03d99f5aa1e:user-4\"
        suggestion-type=\"insertion\" type=\"end\"></suggestion>
</p>
How to solve:

Leave a Reply

Your email address will not be published. Required fields are marked *