开发者

Better way to escape braces in E4X?

开发者 https://www.devze.com 2023-02-17 18:06 出处:网络
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 anythin

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>;
0

精彩评论

暂无评论...
验证码 换一张
取 消