SmartsAutoWeb Support and Discussion Forums

HTML stripping

Share/Bookmark: Add this Thread to Digg Digg   Add this Thread to StumbleUpon Stumble Upon   Add this Thread to Del.icio.us Del.icio.us   Add this Thread to Reddit Reddit   Add this Thread to Facebook Facebook
RE: HTML stripping
by benj on Tue, Jul 15 2008 1:37 PM
You can use a Calculation action to add text to a variable - e.g. assign the result of %a% + %b% to a. Every time the loop executes, variable b will be added to a.

Let me know if I can help develop a scenario.

Thanks,

Ben.
SmartsAutoWeb Support Officer
Quality Componentware Ltd.
benj
benj
Joined: Sun, Jul 13 2008
Posts: 4
RE: HTML stripping
by portedquery on Tue, Jul 15 2008 1:35 PM
ok so theory time -

to write a file how i want - you said about iterating the variables etc.....

i assume you meant create a variable increment the database add to variable etc...
we have no append to file ? so i could write it over during the loop ?
is there an easy way coming in the future ?
writing JScript is technical for some people so are you aiming at techies or lowbies ?
portedquery
Joined: Tue, Jul 15 2008
Posts: 3
RE: HTML stripping
by benj on Tue, Jul 15 2008 1:30 PM
innerText should gebnerally be innerHTML without the HTML tags. Alternatively you could use a Calculation action, and a Javascript function such as the following :

function removeHTMLTags(s)
{
var i, l, prevch, result = "";
var inToken = 0;
var inQuote = false;

for (i=0, l = s.length; i < l; i++)
{
var ch = s.substring(i,i+1);

if (ch == '<' && !inQuote)
{
inToken++;
}
else if (ch == '>' && !inQuote)
{
inToken--;
}
else
{
if (ch == '\"' && prevCh != '\\')
{
inQuote = !inQuote;
}

if (inToken <= 0)
result = result + ch;
}

prevch = ch;
}

return result;
}


Thanks,

Ben
SmartsAutoWeb Support Officer
Quality Componentware Ltd.
benj
benj
Joined: Sun, Jul 13 2008
Posts: 4
HTML stripping
by portedquery on Tue, Jul 15 2008 1:29 PM
if i had innerHTML = "text" how would i remove the crap i didnt need ? and leave myself with just text ?
portedquery
Joined: Tue, Jul 15 2008
Posts: 3