function stripXMLNamespaces(xml:XML):XML
{
var s:String = xml.toString();
var pattern1:RegExp = /\s*xmlns[^\'\"]*=[\'\"][^\'\"]*[\'\"]/gi;
s = s.replace(pattern1, "");
var pattern2:RegExp = /<[\/]{0,1}(\w+:).*?>/i;
while(pattern2.test(s)) {
s = s.replace(pattern2.exec(s)[1], "");
}
return XML(s);
}