Moved some more of the build files around.
This commit is contained in:
parent
991390e242
commit
7d4bf97254
4 changed files with 242 additions and 0 deletions
27
build/js/xml.js
Normal file
27
build/js/xml.js
Normal file
|
@ -0,0 +1,27 @@
|
|||
Object.toXML = function( obj, tag ) {
|
||||
if ( obj.constructor == Array ) {
|
||||
var ret = "";
|
||||
for ( var i = 0; i < obj.length; i++ )
|
||||
ret += Object.toXML( obj[i], tag );
|
||||
return ret;
|
||||
} else if ( obj.constructor == Object ) {
|
||||
var tag = tag || "tmp";
|
||||
var p = "", child = "";
|
||||
|
||||
for ( var i in obj )
|
||||
if ( obj[i].constructor == Array || /</.test(obj[i] + "") || Object.toXML.force[i] )
|
||||
child += Object.toXML( obj[i], i );
|
||||
else
|
||||
p += " " + i + "='" + (obj[i] + "").replace(/'/g, "'") + "'";
|
||||
|
||||
return "<" + tag + p + ( child ? ">\n" + child + "</" + tag + ">\n" : "/>\n" );
|
||||
} else if ( obj.constructor == String ) {
|
||||
//obj = obj.replace(/</g,"<").replace(/>/g,">");
|
||||
//return "<" + tag + "><![CDATA[" + obj + "]]></" + tag + ">";
|
||||
return "<" + tag + ">" + obj + "</" + tag + ">\n";
|
||||
}
|
||||
|
||||
return "";
|
||||
};
|
||||
|
||||
Object.toXML.force = {};
|
Loading…
Add table
Add a link
Reference in a new issue