Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

SitePoint:
Instant XML with PEAR::XML_Serializer
May 17, 2004 @ 12:10:10

SitePoint has a new article posted from Harry Fuecks today entitled Instant XML with PHP and PEAR::XML_Serializer. Thanks to the handy little PEAR::XML_Serializer package, making well-formed simple XML can be just a few function calls away.

These days, XML has become part of landscape in most all areas of software development -- none more so than on the Web. Those using common XML applications, such as RSS and XML-RPC, will probably find public domain libraries geared specifically to help them work with the formats, eliminating the need for wheel re-invention.

[...] PEAR::XML_Serializer works on the principle that XML can be represented as native PHP types (variables). In other words, you can build some array in PHP, pass it to XML_Serializer, and it will give you back an XML document that represents the array. It's also capable of the reverse transformation -- give it an XML document and it can unserialize it for you, returning a PHP data structure representing the document.

This article gives a very through discussion of the package's skills, as well as plenty of examples and function references. Nothing could be simpler than passing an array to this package and getting back a well-formed XML document - and that's just the start of its abilites.

UPDATE: from Dynamically Typed, a mention of an error about XML_Unserializer's lack of a mechanism for calling class methods when unserializing objects.

tagged:

Link:


Trending Topics: