Home arrow PHP arrow Serializing XML With PHP

Serializing XML With PHP

Simplify the task of creating XML documents with the XML_Serializer class, which lets you build nested XML documents from PHP data structures like arrays and objects (and vice versa). I'll show you how to build an XML document tree via the XML_Serializer class from PEAR, how to programmatically create an XML document from an array or an object, how to attach attributes to elements, and how to customize the behavior of the serializer. All this, and much, much more!

  1. Serializing XML With PHP
  2. A Twist In The Tale
  3. Anatomy Class
  4. Total Satisfaction
  5. No Attribution
  6. An Object Lesson
  7. Not My Type
  8. Travelling In Reverse
  9. Keeping It Simple
  10. Linking Out
By: Melonfire
Rating: starstarstarstarstar / 73
April 14, 2004

print this article




Letting the Creative Juices Flow

PHP has always been ahead of the curve when it comes to supporting new technologies; XML is no exception. Early versions of PHP came with basic XML support built in; newer versions improved on this by adding support for new XML protocols and technologies like the DOM, WDDX and SOAP, making PHP one of the most versatile and flexible tools for XML application development.

Now, by default, all newer versions of PHP come with the XML SAX parser enabled; however, the DOM module needs to be explicitly turned on at compile time. If you don't have the ability to recompile your PHP build -- and if you're sharing space on a server, it's quite likely you won't - then you're up a creek without a paddle if your application needs to dynamically create XML document instances.

So, a creative solution is needed -- which is where this article comes in.

Over the next few pages, I'm going to be introducing you to a free PHP class named XML_Serializer, which allows you to create XML documents from PHP data structures like arrays and objects without requiring you to first recompile your PHP build for DOM support. As you might imagine, this can come in handy in certain situations - for example, if you need a quick and dirty way to build an XML document tree from an external data source, like a MySQL database or a structured text file. So keep reading you might find the rest of this show interesting!

>>> 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: