// First pass, extract strings only
for (var i = 0; i < len; i++) {
var key = keys[i];
if (typeof(obj[key]) == 'string') {
if (key == '$t') {
xml += obj[key];
} else {
xml = xml.replace(/>$/, '');
xml += ' ' + key + "='" + obj[key] + "'>";
}
}
}
// Second path, now handle sub-objects and arrays