<table class="sentinelresultitems" style="width: 800px; font-size: 0.5em; margin-top: 30px; margin-left: 50px; margin-right: 50px; display: table;">
<tbody><tr>
<td>
<b>License ID</b>
</td>
<td style="text-align: right">
<b>Product</b>
</td>
/tr>
<tr>
<td>New</td>
<td class="quoteproductname" style="text-align: right">Product > name</td>
</tr>
<tr>
<td>New</td><td class="quoteproductname" style="text-align: right">Another < product name
</td>
</tr>
</tbody>
</table>
Im trying to generate a PDF out of the html string above in c#. But it crashes because i cant separate the <
and >
in the product name, thus resulting in invalid html. And even if i replace them with >
etc, they will still be parsed as >
.
Is it possible to replace the <
and >
with something like GT
and LT
until i get it on the server? After that i can just do a normal text replace on that. Otherwise i will obviously replace all the tags as well.
Thanks in advance
That's what you want ?
var replacers = {
'<': 'GT',
'>': 'LT'
};
var html = $('.sentinelresultitems').html().replace(/[<>]/g, function(match) {
return replacers[match];
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.