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

Zend:
An Introduction to SimpleXML
Apr 29, 2004 @ 11:58:03

Zend has a new tutorial posted this morning covering one of the more anticipated features of PHP5 - SimpleXML.

From SimpleXML: Those of you who have parsed XML with PHP4, or are currently dealing with XML parsing in PHP4, know that it can indeed be very painful to handle documents with any degree of complexity. You either need to use the SAX approach and write a handwritten parser for every document, or you need to use the DOM extension; which (in addition to its tendency to crash, leak and generally misbehave under heavy usage) involves the pain of processing documents using an API designed for a heavily object oriented language and targeted at supporting every single one of XML's idiosyncrasies.

Of course, it's SimpleXML to the rescue. With less than have the code of either DOM or the SAX solutions, SimpleXML is quite a powerful little tool. This article gives plenty of examples on how to parse simple things, parsing namespaces, and working with recusion/edge conditions.

tagged:

Link:


Trending Topics: