PHP
  Home arrow PHP arrow Page 3 - Data Exchange with XML, WDDX and PHP
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Sun Developer Network 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Mobile Linux 
App Generation ROI 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
PHP

Data Exchange with XML, WDDX and PHP
By: Vikram Vaswani, (c) Melonfire
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 4
    2001-09-13

    Table of Contents:
  • Data Exchange with XML, WDDX and PHP
  • The Wonderful World Of WDDX
  • Polly Wants A Cracker
  • Humbert Redfinch-Northbottom The Third, I Presume?
  • Old Friends And New
  • Hip To Be Square
  • The Truth Is Out There
  • Money Talks
  • Closing Time

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Data Exchange with XML, WDDX and PHP - Polly Wants A Cracker


    (Page 3 of 9 )

    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


     

       

    PHP ARTICLES

    - Working With Different Namespaces in PHP 5
    - User Management Explained: Overview
    - Using Namespaces in PHP 5
    - Database Security: Guarding Against SQL Inje...
    - Building a Modular Exception Class in PHP 5
    - Database and Password Security for Web Appli...
    - Handling MySQL Data Set Failures in PHP 5
    - Building Site Registration for Web Applicati...
    - Intercepting Customized Exceptions in PHP 5
    - Securing Your Web Application Against Attacks
    - Sub Classing Exceptions in PHP 5
    - Authentication for Web Application Security
    - Building a Content Management System with Co...
    - Filters and Login Systems for Web Applicatio...
    - Working with the Email Class in Code Igniter





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
    Stay green...Green IT