Better way to escape braces in E4X?
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 ex开发者_StackOverflow社区pression.
I finally found someone who had an answer: escape {
}
as {
}
. But it's really awkward to use. Is there any other way?
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>;
精彩评论