Home arrow PHP arrow Page 3 - Data Exchange with XML, WDDX and PHP

Polly Wants A Cracker - PHP

You may never have heard of it before - but if your job involvesexchanging data between different servers and applications, you're going tobe hearing a lot about it very soon. Find out how WDDX makes it possible tocreate and transmit platform-neutral data structures across the Web, andhow it can be combined with PHP to create a whole new generation of Webapplications (including new content syndication and financial updateservices).

  1. Data Exchange with XML, WDDX and PHP
  2. The Wonderful World Of WDDX
  3. Polly Wants A Cracker
  4. Humbert Redfinch-Northbottom The Third, I Presume?
  5. Old Friends And New
  6. Hip To Be Square
  7. The Truth Is Out There
  8. Money Talks
  9. Closing Time
By: Vikram Vaswani, (c) Melonfire
Rating: starstarstarstarstar / 4
September 13, 2001

print this article


Since WDDX data follows the basic rules of XML markup, it can easily be validated against a DTD. And if you look at the DTD, you'll quickly see that all WDDX "packets" are constructed in a standard format.

The root, or document, element for WDDX data is always the <wddxPacket> element, which marks the beginning and end of a WDDX block.

<wddxPacket version='1.0'>
This is immediately followed by a header containing comments,

<header> <comment>Who da man?</comment></header>
and a data area containing the XML representation of the data structure.

<data> ...</data></wddxPacket>
This data area can contain any of WDDX's basic datatypes, which are described in detail in the WDDX DTD - here's the short version, with examples:

Boolean values, represented by the element <boolean> - for example

<wddxPacket version='1.0'> <header/><data><struct><var name='validUser'><boolean value='true'/></var></struct></data></wddxPacket>
Numbers, represented by the element <number> - for example

<wddxPacket version='1.0'> <header/><data><struct><var name='page'><number>76</number></var></struct></data></wddxPacket>
String values, represented by the element <string> - for example

<wddxPacket version='1.0'> <header/><data><struct><var name='phrase'><string>Polly wants a cracker</string></var></struct></data></wddxPacket>
Arrays and hashes (or associative arrays), represented by the elements <array> and <struct> respectively - for example

<wddxPacket version='1.0'> <header/><data><struct><var name='desserts'><array length='5'><string>apple pie</string><string>angel food cake</string><string>chocolate fudge</string><string>strawberries and cream</string><string>tiramisu</string></array></var></struct></data></wddxPacket>
Tabular data, represented by the element <recordset> - for example

<wddxPacket version='1.0'> <header/><data><recordset rowCount="2" fieldNames="symbol, price"><field name="symbol"><string>HDST</string><string>BDGF</string></field><field name="price"><number>56.78</number><number>373.03</number></field></recordset></data></wddxPacket>
Timestamps, represented by the element <dateTime> - for example

<wddxPacket version='1.0'> <header/><data><struct><var name='today'><dateTime>2001-08-08T16:48:23</dateTime></var></struct></data></wddxPacket>

>>> More PHP Articles          >>> More By Vikram Vaswani, (c) Melonfire

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...

Developer Shed Affiliates


Dev Shed Tutorial Topics: