
Код:
_root.tree2xml = function (xmlNode) {
if (xmlNode.hasChildNodes () or xmlNode.childNodes.length != 0) {
var j = 0;
while (xmlNode.childNodes[j]) {
if (xmlNode.childNodes[j].nodeName == "FONT") {
xmlNode.childNodes[j].nodeName = "SPAN";
delete xmlNode.childNodes[j].attributes.size;
xmlNode.childNodes[j].attributes.STYLE = "N";
}
_root.tree2xml (xmlNode.childNodes[j++]);
}
}
};
xmlTree = new XML ('<P><FONT SIZE=\"12\">text text <FONT SIZE=\"36\">text<FONT SIZE=\"24\">text </FONT></FONT>text<FONT SIZE=\"24\">text </FONT>text</FONT></P>');
xmlTree.ignoreWhite = true;
trace (xmlTree);
trace ("");
_root.tree2xml (xmlTree);
trace (xmlTree);