 
 public class LzXMLTranslator {
 
-static function copyXML (xmlobj, trimwhitespace, nsprefix) {
-    var lfcnode = copyFlashXML(xmlobj, trimwhitespace, nsprefix);
+static function copyXML (xmlobj:XML, trimwhitespace:Boolean, nsprefix:Boolean) :LzDataElementMixin {
+    var lfcnode:LzDataNodeMixin = copyFlashXML(xmlobj, trimwhitespace, nsprefix);
     if (lfcnode == null) {
         trace('LzXMLTranslator.copyXML: lfcnode.children is null', lfcnode);
     }
-    var fc = lfcnode;
-    if ( fc is LzDataText ) {
+    
+    if ( lfcnode is LzDataText ) {
         return null;
     }
-    return fc;
+    
+    return (lfcnode cast LzDataElementMixin);
 }
 
 

  * @param boolean nsprefix: preserve namespace prefixes on node names and attribute names
  * @access private
  */
static function copyFlashXML (node, trimwhitespace, nsprefix) {
    var lfcnode = null;
    // text node?
    if (node.nodeKind() == 'text') {
        var nv = node.toString();
        if (trimwhitespace == true) {
            nv = trim(nv);
        }

//PBR Changed to match swf kernel
//    } else if (node.nodeKind() == 'element') {
      } else {
        
        var nattrs:XMLList = node.attributes();
        var cattrs:Object = {};
        for (var i:int = 0; i < nattrs.length(); i++) {
            var attr:XML = nattrs[i];
            var qattr:QName = attr.name();
            if (nsprefix) {
                var ns:Namespace = attr.namespace();
                var key:String;
                if (ns != null && ns.prefix != "") {
                    key = ns.prefix + ":" + qattr.localName;
                } else {
                    key = qattr.localName;
                }
                cattrs[key] = attr.toString();
            } else {
                cattrs[qattr.localName] = attr.toString();
            }
        }

        var nname:String;
        var qname:QName = node.name();
        if (nsprefix) {
            var ns:Namespace = node.namespace();
            if (ns != null && ns.prefix != "") {
                nname = ns.prefix + ":" + qname.localName;
            } else {
                nname = qname.localName;
            }
        } else {
            nname = qname.localName;
        }

        lfcnode = new LzDataElement(nname, cattrs);
        var children:XMLList = node.children();
        var newchildren:Array = [];
        for (var i:int  = 0; i < children.length(); i++ ) {
            var child:XML = children[i];
            var lfcchild:LzDataNodeMixin = copyFlashXML(child, trimwhitespace, nsprefix);
            newchildren[i] = lfcchild;
        }
        (lfcnode cast LzDataElement).setChildNodes(newchildren);
    }
    return lfcnode;
}
