cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

Converting MKS-HTML in Standard-HTML or Plain Text?

JensN.
13-Aquamarine

Converting MKS-HTML in Standard-HTML or Plain Text?

Hi all,

 

We have some notification triggers that send our users a mail about specific situations. These triggers then read certain fields of the triggering item in order to use these contents in the text of the mail for a quick overview. Some of these fields are rich text fields, which are basically composed of MKS-HTML code. But now this code can't be understood by Outlook or other mail programs, so that the MKS-HTML tags can be seen in the text of the mail, which makes the whole thing very difficult to read.   

Has anyone found a way to filter out this MKS HTML code or convert it to normal HTML without parsing all the text in the mail trigger script? Thank you....

 

kind regards, Jens

1 ACCEPTED SOLUTION

Accepted Solutions

Hello Jens,

you could use JavaScript and/or Java to filter XML Tags away (via RegEx).

You may also retrieve the text only via build in API call and appropriate option.

Would suggest to start with ReqEx first.

Does this help?

Volker   

View solution in original post

3 REPLIES 3

Hello Jens,

you could use JavaScript and/or Java to filter XML Tags away (via RegEx).

You may also retrieve the text only via build in API call and appropriate option.

Would suggest to start with ReqEx first.

Does this help?

Volker   

JensN.
13-Aquamarine
(To:VolkerEckardt)

Hi Volker,

 

yes, this could work, but my first intention was to find a way without parsing the whole text. Not very realistic, but you never knows...:)

 

kind regards, Jens

 

JensN.
13-Aquamarine
(To:VolkerEckardt)

Hi Volker,

 

tried it with RegEx and it seems to went well. At the moment I am sending the complete text of the mail through this function, and so far the complete HTML code is replaced by line breaks and spaces. Maybe there are some special tags that I don't handle at the moment, but for us it's enough. Mabe it helps someone else too...

 

function killTags(string) {
	var re1 = new RegExp('<br[^>]*>','g');
	var re2 = new RegExp('<p[^>]*>', 'g');
	var re3 = new RegExp('<[^>]*>', 'g');
	return ('' + string).replace(re1,'\n').replace(re2,'\n').replace(re3,'');
}

kind regards, Jens

 

 

Top Tags