Cleaning/parsing HTML & XML

Andre Garzia andre at andregarzia.com
Mon Nov 10 23:43:13 EST 2008


Willian,

I usually use Ken Rays stsXMLLib which I grew very fond of.

A nice way of escaping XML entities is to use a custom property as a
little map, for example:

< >
> <
& &

Then you do a loop like:

repeat for each line tEntry in the cReplacementMap of this stack
  replace word 1 of tEntry with word 2 of tEntry in theText
end repeat

this way, if you ever need to escape something more, you don't need to
change your code. I have a lot of XML, XHTML, *ML code here and I find
that every time I hard code something like a collection of things to
replace of thing like that, in the end, I need to change and fix
several parts of the code.

custom properties are your friend!

Cheers
andre

On Sat, Nov 8, 2008 at 8:30 PM, william humphrey <shoreagent at gmail.com> wrote:
> I'm generating my own XML without using the XML functions of RunRev (it's
> faster and I can format exactly how I want it to look). But I would like a
> function for cleaning the text for "&" to & and that kind of thing.
> Any suggestions for such a function? There must be one in RunRev that the
> XML library uses.
>
> Thanks,  Bill
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>



-- 
http://www.andregarzia.com All We Do Is Code.



More information about the use-livecode mailing list