特定のクラス要素にのみ存在する「href」属性を取り除きたいです。
String html="<div>This is my example:
<a class="class1" href="www.example.com">Hello World</a>. More data:
<a class="class2" href="www.nuisance.com">
Keep this text but remove its reference
</a></div>"
望ましい出力:
String newhtml="<div>This is my example:
<a class="class1" href="www.example.com">Hello World</a>. More data:
<a class="class2">
Keep this text but remove its reference
</a></div>
NewTraversor()
andを使用して属性を削除するために JSoup を使用していましたがtrasverse
、指定されたすべての属性が削除され、特定のクラスに関連付けられているものだけを削除したいと考えています。ご協力ありがとうございます。