If you haven't taken the time to acquaint yourself with XML or PHP, here's a nano-course:
Now that you're had the nano-course you can check out the micro-course in the first chapter of "XML and PHP", by Vikram Vaswani. There you'll get a quick overview of both XML and PHP. If you're already taken a look at the syntax of XML, this will serve as a handy reminder of the purpose behind XSL, Schemas, Xlink, etc. The PHP overview is too brief to do much beyond give you the flavor of the language, but it serves the purpose of conveying the relief that one experiences upon encountering a language that does its job and stays out of your way.
In the crowded world of technical books, it seems the majority are bloated collections of information exploiting the latest hype or "click here and you'll see this dialog" handholding. O'Reily publishing made a name for themselves by bucking this trend and putting out useful tomes that tend to be both readable and a fraction of the weight (and dead tree count) of many others. New Riders, the publisher of this book, is following suit with some good writing, good editing, and high quality content. The three I've read, "MySQL", "Advanced PHP for Web Programming", and now "XML and PHP", have all been good. What I like about Vaswani's writing in "XML and PHP" is that he has a sense of humor and turns a good phrase, but never strays from the focus or gets condescending.
After the short refresher on PHP and XML mentioned above, we dive right into SAX, a processor for eating up XML and spitting out each element it finds. This is followed by a discussion of PHP's Document Object Model (DOM) functions, with which you can read an entire XML document into memory and then refer to its component parts in terms of parent and children nodes and their data. This leads to perhaps the most immediately useful section of the book, a discussion on the differences between the serial approach SAX takes and the holistic DOM method and in what situations you would use one over the other.
As we move through new topics and their examples, I like how the complete code is given each time, rather than illustrating only the bit being discussed. This way, you continually see how the whole fits together, and the PHP syntax is clean enough that it takes little effort to scan the listing for the function of interest.
A full chapter on using PHP's XSLT processor, detailed treatments of the various ways of passing both data and commands via XML (WDDX, SOAP, and XML-RPC ), simplified DOM traversal with Xpath, a extensive comparison of relational databases and XML, how to export data from MySQL into XML - it's all here. What if you don't have compile access to your server and thus can't make use of all the PHP XML functions? There are several Open Source alternatives given fair treatment, with both caveats and benefits.
XML is a very generalized beast, and there are several ways of doing anything. As one example, XSLT is a mechanism for translating XML into other formats such as HTML, but it can also be used as a mini-language to do some of the processing you might otherwise do in PHP. As our knowledge and thus the varied options mount toward the end of the book, alternate solutions to the same problem are presented in turn. This could easily become pedantic, but the quick pace makes for easy reading. In addition, a chapter on real-world case studies summarizes the concepts for us.
The real question with any book is whether buying it is money well-spent. In many cases you can do as well with online forums, help files, man pages, etc. In the case of PHP and XML, however, I wouldn't recommend self-help. You'll burn up a lot of time and if your time is worth anything at all you'll come out ahead by coughing up the 40 bucks for this book.
I give this one two thumbs up. Recommended.
Ron Newman