jeudi 8 décembre 2016

How do I copy an XMLList and keep the namespace?

Is there a way to copy an XMLList and keep the namespace? It seems when I use the copy() method on an XMLList the namespace is being removed.

Code:

var xml:XML = <s:Label xmlns:s="library://ns.adobe.com/flex/spark"><s:color>red</s:color>
        test level</s:Label>;

var elements:XMLList = xml.elements();
//var elements:XMLList = xml.descendants();
trace(elements.toXMLString());

var copy:XMLList = elements.copy();
trace(copy.toXMLString());

elements.toXMLString():

<s:color xmlns:s="library://ns.adobe.com/flex/spark">red</s:color>

copy.toXMLString():

<color xmlns="library://ns.adobe.com/flex/spark">red</color>

I need to be able to keep the namespace when I make the copy.

Aucun commentaire:

Enregistrer un commentaire