XMLDBX XML extension for PHP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



A while back I tried to use wddx as an XML serializer for PHP, and for
various reasons it didn't really work correctly. What I ended up having to
do was almost completely rewrite it, and what came out of that is XMLDBX.

Here is documentation 
http://www.mohawksoft.org/?q=node/17

You can download the extension from "Download" under "Code and
Documentation"
http://www.mohawksoft.org/?q=node/32

By using the "classname" attribute and setting the type to "object," the
xmldbx extension will create a PHP class. For instance:

A PHP class defined like this:

class testxml
{
        var     $foo;
        var     $bar;
};

Can be instantiated with XML like this:
<xmldbx version='1.0' ><data cn='testxml' t='o'><foo t='sz' v='Test'/><bar
t='sz' v='1 2 3 4'/></data></xmldbx>

This code:
class testxml
{
        var     $foo;
        var     $bar;
};
$filename = "/tmp/test.xml";
$file = fopen($filename, "r");
if($file)
{
        $tv=0;
        $data = fread($file,filesize($filename));
        $tv = xmldbx_deserialize($data);
        print("<PRE>\n");
        print_r ($tv);
        print("</PRE>\n");
}

Produces This:
<PRE>
testxml Object
(
    [foo] => Test
    [bar] => 1 2 3 4
)
</PRE>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux