2016-07-29 80 views
0

我有以下字符串格式的html。字符串格式的HTML特定標記的Unescape字符java

<html> 

    <head> 
     <title>DEMO</title> 
    </head> 

    <body> 

     <tag1 att1="&#38;lt;hello/&#38;gt;" att2="&#38;lt;hi/&#38;gt;" /> 

     <tag2 attr1="hello" /> 

    </body> 

我jusy想<>反轉義的att2屬性值,保持其他值,因爲它是。

請幫忙。

+0

您已經嘗試了什麼標籤的屬性名相同? –

+0

html的格式不同嗎?或者我們可以假設tag1和att2總是在同一行? –

+0

yes attr2將始終與tag1一起出現。但標籤可能會出現多次。與許多其他標籤。 – user3287034

回答

0

可以遍歷HTML使用jQuery和比申請更換,如果你想

$(data).find(tagName).each(function(index) { 

    var tagValue= $(this).attr("AttributeName"); 

    // perform your repalce login here unescape(tagValue) 

}) 
+0

不使用jquery。 – user3287034