I have following CDATA inside xml document:
<![CDATA[ <p xmlns="">Refer to the below: <br/>
</p>
<table xmlns:abc="http://google.com pic.xsd" cellspacing="1" class="c" type="custom" width="100%">
<tbody>
<tr xmlns="">
<th style="text-align: left">Basic offers...</th>
</tr>
<tr xmlns="">
<td style="text-align: left">Faster network</td>
<td style="text-align: left">
<ul>
<li>Session</li>
</ul>
</td>
</tr>
<tr xmlns="">
<td style="text-align: left">capabilities</td>
<td style="text-align: left">
<ul>
<li>Navigation,</li>
<li>message, and</li>
<li>contacts</li>
</ul>
</td>
</tr>
<tr xmlns="">
<td style="text-align: left">Data</td>
<td style="text-align: left">
<p>Here visit google for more info <a href="http://www.google.com" target="_blank"><font color="#0033cc">www.google.com</font></a>.</p>
<p>Remove this href tag <a href="/abc/def/{T}/t/1" target="_blank">Information</a> remove the tag.</p>
</td>
</tr>
</tbody>
</table>
<p xmlns=""><br/>
</p>
]]>
I want to some how scan for href=”/abc/def and remove the href tag which starts with abc/def. In above example remove the href tag and just leave “Information” text inside the tag. CDATA can have more than one href tags with “abc/def… in it.
I am using C# for this application. Can someone please help me and tell me how this can be done? Should i use regex or is there a way to do it with xml itself?
This is the regex i am trying:
"<a href=\"/abc/def/.*></a>"
I want to keep inner text of the a href tag just remove the tags. But above regex is not working.
Using HtmlAgilityPack