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

DevArticles:
Understanding XML The Easy Way
Jan 07, 2003 @ 13:45:02

So working with standard flat-text files is boring, and a database is just more trouble than it's worth - you need something in the middle. Something that's structured like a database, but not as complex - something simple like XML. PHP and XML have gone hand in had ever since PHP's parsers were introduced, and now, thanks to this DevArticles piece, it can be easy to work with too.

In Converting XML Into a PHP Data Structure, they show you how to convert a simple XML structure (a file system example) into an array in PHP. They use the SAX parser in PHP to do the hard work, converting the XML structure into a nice, clean array - and making it much easier for you to parse and use any XML resource. The parser even handles attributes wonderfully. Simply plug in this script to your libraries you already have, and you'll have a simple, portable, easy to use way to integrate any XML feed into your site.

tagged:

Link:


Trending Topics: