NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: broche on February 08, 2016, 10:03:29 AM

Title: xHTML to Text
Post by: broche on February 08, 2016, 10:03:29 AM
Hi,

NT9.05 Apps
Cl 10

I need to convert an xHTML field to Text to include in an email body.
Any ideas?

Brian
Title: Re: xHTML to Text
Post by: kevin plummer on February 08, 2016, 11:05:59 PM
string theory?
Title: Re: xHTML to Text
Post by: broche on February 09, 2016, 07:55:43 AM
Looked at String Theory but not sure I understand it if it is there?
Title: Re: xHTML to Text
Post by: broche on February 09, 2016, 07:56:37 AM
For now I moved all fields back to plain text so I don't have this issue.

Thanks.
Title: Re: xHTML to Text
Post by: kevin plummer on February 09, 2016, 02:19:09 PM
I was thinking you could use ST to remove all tags and convert some to cr\lf etc to automatically translate from xhtml to plain text.
Title: Re: xHTML to Text
Post by: broche on February 10, 2016, 12:07:04 AM
Thanks, yes I looked at doing that.  My limitation is knowing all the tags I suppose.
I will tackle this in my test environment as I like the xHTML look for the text fields for my customers.
Title: Re: xHTML to Text
Post by: kevin plummer on February 10, 2016, 02:05:17 PM
check out remove in ST it might do the trick.
Title: Re: xHTML to Text
Post by: Bruce on February 14, 2016, 11:00:38 PM
see RemoveAttributes
http://www.capesoft.com/docs/StringTheory/StringTheory.htm#stRemoveAttributes

That cleans it up a bit. Then Replace to replace some tags with text - for example replacing <br> or <br/> or <p> with CR/LF (ie '<13,10>')

Then other tags need replacing as well, some requiring some thought, especially <ol> and <ul> (ordered and unordered lists), tables and so on.

Cheers
Bruce