Created
June 28, 2010 22:17
-
-
Save claus/456446 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ok i want a root <a> node that has two children: a <b> node and a random text node | |
// the random text node should be automatically escaped if appropriate: | |
// <a> | |
// <b/> | |
// a < b | |
// </a> | |
var txt:String = "a < b"; | |
var xml:XML = <a/>; | |
xml.appendChild(<b/>); | |
xml.appendChild(txt); | |
trace(xml.toXMLString()); | |
// this creates an extra <b> element. BUG! | |
// <a> | |
// <b/> | |
// <b>a < b</b> | |
// </a> | |
// the only workaround i found is this: | |
var txt:String = "a < b"; | |
var xml:XML = <a/>; | |
xml.appendChild(<b/>); | |
xml.appendChild(<dummy>{txt}</dummy>.children()[0]); | |
trace(xml.toXMLString()); | |
// <a> | |
// <b/> | |
// a < b | |
// </a> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment