XML2Object revisited
import it.sephiroth.XMLObjectThe second addition to this class is the parseObject method, which will convert any object into an xml. for example, this code:
myxml.onLoad = function(){
var data = new XMLObject().parseXML( this, true );
}
import it.sephiroth.XMLObjectwill produce this xml string:
myobject = {
attributes : {
name : "custom object",
type : 1
},
item : [ { name : "Varese", code : "VA" }, { name : "Milano", code : "MI" } ],
channel : { name : "City", country : "Italy" } }
data = new XMLObject().parseObject(myobject,"TEST")
<?xml version="1.0"?>And here's the class code:
<TEST type="1" name="custom object">
<item>
<name>Varese</name>
<code>VA</code>
</item>
<item>
<name>Milano</name>
<code>MI</code>
</item>
<channel>
<name>City</name>
<country>Italy</country>
</channel>
</TEST>
http://www.sephiroth.it/_temp/xmlobject.html
