Lots of documentation overhaul - much more documented, cat output works better now.

This commit is contained in:
John Resig 2006-09-01 05:52:26 +00:00
parent 805d21c236
commit c8009abcce
7 changed files with 1181 additions and 1180 deletions

View file

@ -9,15 +9,13 @@ Object.toXML = function( obj, tag ) {
var p = "", child = "";
for ( var i in obj )
if ( obj[i].constructor != String || /</.test(obj[i] + "") || Object.toXML.force[i] )
if ( ( obj[i].constructor != String && obj[i].constructor != Number ) || /</.test(obj[i] + "") || Object.toXML.force[i] )
child += Object.toXML( obj[i], i );
else
p += " " + i + "='" + (obj[i] + "").replace(/'/g, "&apos;") + "'";
return "<" + tag + p + ( child ? ">\n" + child + "</" + tag + ">\n" : "/>\n" );
} else if ( obj.constructor == String ) {
//obj = obj.replace(/&lt;/g,"<").replace(/&gt;/g,">");
//return "<" + tag + "><![CDATA[" + obj + "]]></" + tag + ">";
} else if ( obj.constructor == String || obj.constructor == Number ) {
return "<" + tag + ">" + obj + "</" + tag + ">\n";
}