node = function ( name, value ) {
var output = "<n>v</n>";
output = output.replace( "v", ( regex.cdata.test( value ) ? "<![CDATA[" + value + "]]>" : value ) );
return output.replace(/<(\/)?n>/g, "<$1" + name + ">");
};
if ( arg !== null && arg.xml !== undefined ) {
arg = arg.xml;
}
if ( arg instanceof Document ) {
arg = ( new XMLSerializer() ).serializeToString( arg );
}
if ( regex.boolean_number_string.test( typeof arg ) ) {
x += node( "item", arg );
}
else if ( typeof arg === "object" ) {
utility.iterate( arg, function ( v, k ) {
x += xml.encode( v, ( typeof v === "object" ), false ).replace( /item|xml/g, isNaN( k ) ? k : "item" );
});
}
x += wrap ? "</xml>" : "";
if ( top ) {
x = "<?xml version=\"1.0\" encoding=\"UTF8\"?>" + x;
}
return x;
}
catch ( e ) {
utility.error( e, arguments, this );
return undefined;
}
},
Method decode
Parameters:
(XML String)
Returns an Object
(XML Object or undefined)