Escaping TextGenBuffer


I'm currently generating text from a model.

Now i need this text to be embeded in a xml-file.

So I need to escape characters like < " > ' etc.

I wanted to use buffer.getText() then escape everything and write it back to the buffer.
How can I overwrite or clean the buffer?

If that's not working I would have to write to my own Buffer(e.g. a singleton) and then just append that once to the text-gen-buffer. But the problem is, that then I would have to rewrite all the textgens I've already created... Not a nice solution...

Comment actions Permalink
Looks like now you have to create new (static) buffer with automatic escaping logic and modify all existing text gen to use it.

You can use MPS migration capability to automatically change those text gens already created - see scripts aspect of your language.
Comment actions Permalink
I'm thinking about writing a M2M generator which reduces everything to a list of one concept and then write just one textGenerator which will do all the escaping stuff.

This seems a bit more straight forward, cause I dont need no buffer here.
Comment actions Permalink
well, you still have to deal with escaping on textGenerator.

Please sign in to leave a comment.