SXI Forum

A place to collect usefull tips, tricks and implementation strategies.

You are not logged in.

#1 21-11-2018 15:30:45

SeanR
Administrator
Registered: 20-11-2018
Posts: 147

Rules: Strip html tags from a given value

Example of an Html formatted email body before rule application:

<div dir="ltr"><div class="gmail_quote"><div style="border:none;border-top:solid #e1e1e1 1.0pt;padding:3.0pt 0cm 0cm 0cm"><br>
<p class="MsoNormal"><u></u> <u></u></p>
<table border="0" cellspacing="1" cellpadding="0" width="100%" style="width:100.0%">
<tbody>
<tr>
<td colspan="2" style="background:#e0e0e0;padding:3.75pt 3.75pt 3.75pt 3.75pt">
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:&amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;">This is an auto generated e-mail triggered because of the following entities being monitored :
</span><u></u><u></u></p>
</td>
</tr>
<tr>
<td width="120" style="width:90.0pt;background:#cccccc;padding:3.75pt 3.75pt 3.75pt 3.75pt">
<p align="right" style="text-align:right"><span style="font-size:10.0pt;font-family:&amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;">Monitor</span><u></u><u></u></p>
</td>
<td width="580" style="width:435.0pt;background:#f9f9f5;padding:3.75pt 3.75pt 3.75pt 3.75pt">
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:&amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;">ho-vmspapp-01</span><u></u><u></u></p>
</td>
</tr>
<tr>
<td width="120" style="width:90.0pt;background:#cccccc;padding:3.75pt 3.75pt 3.75pt 3.75pt">
<p align="right" style="text-align:right"><span style="font-size:10.0pt;font-family:&amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;">Attribute</span><u></u><u></u></p>
</td>
<td width="580" style="width:435.0pt;background:#f9f9f5;padding:3.75pt 3.75pt 3.75pt 3.75pt">
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:&amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;">Health</span><u></u><u></u></p>
</td>
</tr>
<tr>
<td width="120" style="width:90.0pt;background:#cccccc;padding:3.75pt 3.75pt 3.75pt 3.75pt">
<p align="right" style="text-align:right"><span style="font-size:10.0pt;font-family:&amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;">Reasons</span><u></u><u></u></p>
</td>
<td width="580" style="width:435.0pt;background:#f9f9f5;padding:3.75pt 3.75pt 3.75pt 3.75pt">
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:&amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;">Health of ho-vmspapp-01 is critical</span><u></u><u></u></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal"><u></u> <u></u></p>
<table border="0" cellspacing="0" cellpadding="0" width="100%" style="width:100.0%">
<tbody>
<tr>
<td width="698" style="width:523.5pt;background:#aaaaaa;padding:3.75pt 3.75pt 3.75pt 3.75pt">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:&amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;color:white">Root Cause</span></b><u></u><u></u></p>
</td>
</tr>
<tr>
<td width="698" style="width:523.5pt;background:#f9f9f5;padding:3.75pt 3.75pt 3.75pt 3.75pt">
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-size:10.0pt;font-family:&amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;">Root Cause :
<br>
1. Total Disk Utilization(%) 91 &amp;gt; 90 (threshold).<br>
2. SharePoint Server Search 14 is down</span><u></u><u></u></p>
</td>
</tr>
</tbody>
</table>
<p style="margin:0cm;margin-bottom:.0001pt"><u></u> <u></u></p>
<table border="0" cellspacing="0" cellpadding="0" width="100%" style="width:100.0%">
<tbody>
<tr>
<td width="698" style="width:523.5pt;background:#aaaaaa;padding:3.75pt 3.75pt 3.75pt 3.75pt">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:&amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;color:white">Additional information</span></b><u></u><u></u></p>
</td>
</tr>
<tr>
<td width="698" style="width:523.5pt;background:#f9f9f5;padding:3.75pt 3.75pt 3.75pt 3.75pt">
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:&amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;">This information has been generated by the Applications Manager</span><u></u><u></u></p>
</td>
</tr>
<tr>
<td width="698" style="width:523.5pt;background:#f9f9f5;padding:3.75pt 3.75pt 3.75pt 3.75pt">
</td>
</tr>
</tbody>
</table>
<p><u></u> <u></u></p>
<table border="0" cellspacing="1" cellpadding="0" width="100%" style="width:100.0%">
<tbody>
<tr>
<td style="padding:3.75pt 3.75pt 3.75pt 3.75pt">
<p align="right" style="text-align:right"><b><span style="font-size:10.0pt;font-family:&amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;color:#999999">Reported By :
<a href="9090?fea"" target=""_blank"">Applications Manager</a></span></b><u></u><u></u></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal"><span style="color:windowtext"><u></u> <u></u></span></p>
<br>
<table border="0" cellspacing="0" cellpadding="0"><tbody><tr><td><img border=""0"" src="114021409091601043@za-mta-7.za.mimecast.lan"" /></td></tr></tbody></table>
<font face="arial" size="1">
<hr>
<b>Disclaimer</b>
<br>
Everything in this e-mail and any attachments relating to the official business of Acme Holdings Ltd. and its subsidiaries ('Acme') is proprietary to Acme. It is confidential, legally privileged and protected by law. Acme does not own and endorse any other content.

Views and opinions are those of the sender unless clearly stated as being that of Acme. The person addressed in the e-mail is the sole authorised recipient. Please notify the sender immediately if it has unintentionally reached you and do not read, disclose or use the content in any way.

Acme cannot assure that the integrity of this communication has been maintained nor that it is free of errors, virus, interception or interference.
<br>
</font>
<hr>
<table border="0" cellspacing="0" cellpadding="0"><tbody><tr><td><img border=""0"" src="114021409091600943@za-mta-7.za.mimecast.lan"" /></td></tr></tbody></table>
<br>
<br>
null null</pre>

Configure the following rule to remove unwanted html tags:


<sxi:Field name="Body">
	<sxi:Rules>
		<sxi:Substitute>
		
			<sxi:Find>&amp;lt;(.|n)*?&amp;gt;</sxi:Find>

			<sxi:Replace/>
		</sxi:Substitute>
	</sxi:Rules>
	<sxi:OutputField>NewBody</sxi:OutputField>
</sxi:Field>

Output after rule application:


This is an auto generated e-mail triggered because of the following entities being monitored :
Monitor
ho-vmspapp-01
Attribute
Health
Reasons
Health of ho-vmspapp-01 is critical
Root Cause
Root Cause :
1. Total Disk Utilization(%) 91 &amp;gt; 90 (threshold).
2. SharePoint Server Search 14 is down
Additional information
This information has been generated by the Applications Manager
Reported By :
Applications Manager
Disclaimer
Everything in this e-mail and any attachments relating to the official business of Acme Holdings Ltd. and its subsidiaries ('Acme') is proprietary to Acme. It is confidential, legally privileged and protected by law. Acme does not own and endorse any other content.

Views and opinions are those of the sender unless clearly stated as being that of Acme. The person addressed in the e-mail is the sole authorised recipient. Please notify the sender immediately if it has unintentionally reached you and do not read, disclose or use the content in any way.

Acme cannot assure that the integrity of this communication has been maintained nor that it is free of errors, virus, interception or interference.

Offline

#2 22-11-2018 07:48:51

SeanR
Administrator
Registered: 20-11-2018
Posts: 147

Re: Rules: Strip html tags from a given value

It is possible that the <(.|n)*?> regex could cause stackoverflow errors where the system runs out of memory.

It is recommended that this <.*?> regex rather be used .

An SXI request has been logged to have a stripHTML rule developed.

Offline

#3 22-11-2018 07:49:18

SeanR
Administrator
Registered: 20-11-2018
Posts: 147

Re: Rules: Strip html tags from a given value

The stripHTML rule has been added to the XLayer Rules library and should be used to strip HTML markup from data.

Offline

Board footer

Powered by FluxBB