blueshoes php application framework and cms            javascript_core
[ class tree: javascript_core ] [ index: javascript_core ] [ all elements ]

Class: Bs_Wddx

Source Location: /core/util/Bs_Wddx.class.js.php

Class Overview


Bs_Wddx.class.js Basic transformer from any Javascript type to WDDX-format and back. Used mainly for js-rs: Passing data from js-code to the server script (written in PHP in my case) and back to the script.


Author(s):

Version:

  • 4.0.$Id: Bs_Wddx.class.js,v 1.3 2003/09/15 15:02:13 andrej Exp $

Copyright:

  • blueshoes.org

Methods


Inherited Variables

Inherited Methods


Class Details

[line 39]
Bs_Wddx.class.js Basic transformer from any Javascript type to WDDX-format and back. Used mainly for js-rs: Passing data from js-code to the server script (written in PHP in my case) and back to the script.

Usage Sample: var jsVar = new Object(); // Take any random Object jsVar.anArray = new Array(1,2,"hallo!", "<hallo>!");

var wddx = new Bs_Wddx(); // Create the WDDX-handler instance var wddxXml = wddx.serialize(jsVar); // Serialize the JS-variable // Transfer the WDDX data to where you want var tmp = wddx.serialize(wddxXml); // Deserialize the wddx-XML data back to the JS-variable

INFO: PHP Object Support

  • Object hadling in WDDX is very poorly and inconsistently supported (Found that out *after* implementation :-( ). If you pass a WDDX-js-objects it will convert to a simple PHP-hash array. This is usually fully sufficient; If you want PHP to instanciate a PHP-object you *must* add a attribute name called 'php_class_name' to the js-object and set it to the PHP class name you wish to instanceiate. PHP will then try to create that class. I recomend to live without this feature.
INFO: Js Object Support When deserializing:
  • If you want specific js-object to be instanciated from the WDDX data, then the class name musst be given in the 'type' of the WDDX <struct>-tag. E.g. <struct type='MyClassName'>...</struct>. Unfortunately PHP's WDDX does *not* support this feature. I recomend to live without this feature.
NOTE:
  • WDDX extion 'recordset', 'binary' and timezone are not supported (yet?)




Tags:

access:  public
version:  4.0.$Id: Bs_Wddx.class.js,v 1.3 2003/09/15 15:02:13 andrej Exp $
copyright:  blueshoes.org
author:  Sam Blum <at blueshoes dot org>


[ Top ]


Class Methods


method deserialize [line 137]

(mixed) deserialize( string wddxPacket)

Unserialize a WDDX packet



Tags:

return:  A js-variable or js-object


Parameters:

string   wddxPacket   WDDX pack (XML)

[ Top ]

method serialize [line 50]

string serialize( obj obj)

Creates a WDDX packet INFO: Put all your data in one 'top-level' variable or object and pass it to this function.



Tags:

return:  A WDDX Package (= XML)


Parameters:

obj   obj   the 'top-level' variable or object

[ Top ]

method _parseSimpleType [line 209]

void _parseSimpleType( mixed wddxElement)



[ Top ]

method _recursiveDeserialize [line 156]

void _recursiveDeserialize( mixed wddxElement)

Called by the Deserializer function



[ Top ]

method _recursiveSerialize [line 59]

void _recursiveSerialize( obj obj)

Convert js-vars and js-objects to corresponding WDDX recursively



Parameters:

obj   obj   any variable or object

[ Top ]

method _unEntityNummeric [line 264]

void _unEntityNummeric( mixed str)

Instead of ret.replace(/&#x0D;/g,'\r').replace(/&#x0C;/g,'\f').replace(/&#x0A;/g,'\n').replace(/&#x09;/g,'\t');



[ Top ]


Documentation generated on Mon, 29 Dec 2003 22:18:36 +0100 by phpDocumentor 1.2.3