0

I have some XML I'm generating with {} characters, which are of course used for substitution.

It's hard to find any info on this: MDC is usually great documentation, but it doesn't mention anything about how to put brace literals in an E4X expression.

I finally found someone who had an answer: escape { } as { }. But it's really awkward to use. Is there any other way?

Ken
  • 613
  • 4
  • 6
  • Your XML structure sounds rather broken if you have tag/attribute names that are to be substituted... – poke Mar 20 '11 at 02:12
  • poke: I'm not sure why that's "broken", but I also never said that's what I'm doing. E4X allows brace substitution basically anywhere. – Ken Mar 20 '11 at 02:35
  • Then could you maybe show an example of what you are trying to do? – poke Mar 20 '11 at 15:02
  • He's trying to do something like this: `var xml:XML = {this text is in braces};` which doesn't work. – Chris Burt-Brown Mar 21 '11 at 14:18

1 Answers1

1

Perhaps the cleanest method I can see is to substitute the braces in!

var text:String = "some {text} with {braces}";
var xml:XML = <something>{text}</something>;
Chris Burt-Brown
  • 2,717
  • 1
  • 16
  • 16