   * trim whitespace from start and end of string
   * @access private
   */
-static function trim( str ) {
-    var whitech = whitespaceChars;
-    var len = str.length;
-    var sindex = 0;
-    var eindex = str.length -1;
-    var ch;
+static function trim( str:String ) :String {
+    var whitech:Object = whitespaceChars;
+    var len:int = str.length;
+    var sindex:int = 0;
+    var eindex:int = str.length -1;
+    var ch:String;
     while (sindex < len) {
         ch = str.charAt(sindex);
         if (whitech[ch] != true) break;


public class LzXMLTranslator {

static function copyXML (xmlobj, trimwhitespace, nsprefix) {
    var lfcnode = copyFlashXML(xmlobj, trimwhitespace, nsprefix);
    if (lfcnode == null) {
        trace('LzXMLTranslator.copyXML: lfcnode.children is null', lfcnode);
    }
    var fc = lfcnode;
    if ( fc is LzDataText ) {
        return null;
    }
    return fc;
}



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