Whatever message this page gives is out now! Go check it out!
| Function syntax | Description |
object.serialize(rootobj) | Creates a WDDX packet for a passed WddxRecordset instance. |
object.serializeVariable(name, obj) | Serializes a property of a structure. If an object is not a string, number, array, Boolean, or a date, WddxSerializer treats it as a structure. |
object.serializeValue(obj) | Recursively serializes eligible data in a passed instance. |
object.write(str) | Appends data to the serialized data stream. |
object.serialize( rootobj ) |
| Parameter | Description |
object | Instance name of the WddxSerializer object |
rootobj | JavaScript data structure to serialize |
function serialize(data, formField)
{
wddxSerializer = new WddxSerializer();
wddxPacket = wddxSerializer.serialize(data);
if (wddxPacket != null)
{
formField.value = wddxPacket;
}
else
{
alert("Couldn't serialize data");
}
}object.serializeVariable( name, obj ) |
| Parameter | Description |
object | Instance name of a WddxSerializer object |
name | Property to serialize |
obj | Instance name of the value to serialize |
...
// Some generic object; treat it as a structure
this.write("<struct>");
for (prop in obj)
{
bSuccess = this.serializeVariable(prop, obj[prop]);
if (! bSuccess)
{
break;
}
}
this.write("</struct>");
...object.serializeValue( obj ) |
| Parameter | Description |
object | Instance name of the WddxSerializer object |
obj | Instance name of the WddxRecordset object to serialize |
...
this.wddxPacket = "";
this.write("<wddxPacket version='1.0'><header/><data>");
bSuccess = this.serializeValue(rootObj);
this.write("</data></wddxPacket>");
if (bSuccess)
{
return this.wddxPacket;
}
else
{
return null;
}
...object.write( str ) |
| Parameter | Description |
object | Instance name of the WddxSerializer object |
str | String to be copied to the serialized data stream |
...
else if (typeof(obj) == "number")
{
// Number value
this.write("<number>" + obj + "</number>");
}
else if (typeof(obj) == "boolean")
{
// Boolean value
this.write("<boolean value='" + obj + "'/>");
}
...