We will begin by making use of the
WDDX functions that PHP offers for free, no
need to create our own XML parser or even know the WDDX DTD, we can just use
them and be happy.
The WDDX functions do
not need any external library, and implement methods to generate, serialize
and deserialize information into WDDX packets.
WDDX, the Web Distributed Data Exchange, is an XML application that:
"... is a mechanism for exchanging complex data structures between application
environments. It has been designed with web applications in mind. WDDX
consists of a language and platform neutral representation of instantiated
data based on XML 1.0 (which is defined using this DTD) and a set of
serializer/ deserializer components for every environment that uses WDDX. The
process of creating an XML representation of application data is called
serialization. The process of instantiating application data from a WDDX XML
representation is called deserialization. "
WDDX has a simple DTD, and can be used to serialize variables of different
types. The DTD recognizes variables of type string, numeric, and boolean, as
well as arrays (when the indexes are numeric) and structures (when the indexes
are strings, also called associative arrays). Complex data structures can
also be represented (e.g. arrays of arrays).