XMLDBX XML extension for PHP
| From: | Mark | Date: | Thu, 08 Mar 2007 16:48:45 +0000 |
| Subject: | XMLDBX XML extension for PHP | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-250083@lists.php.net to get a copy of this message | ||
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>