No Nonsense XML Web Development with PHP, Thomas Myer

PHP doesn’t spring to mind when thinking about processing XML data, but PHP is a better solution than you might think. Since PHP is used to develop websites, which use HTML a standard based on the principles of XML, PHP is a sensible choice. PHP also includes powerful tools for parsing and manipulating XML data. We can use this to our advantage to convert and manipulate XML information in our PHP based web applications. XML-RPC and SOAP also use XML, so the use of a web-based language for web-services is also another obvious choice.

All of these situations are covered in extensive detail by Thomas Myer in his new book, No Nonsense XML Web Development with PHP from publisher SitePoint, a long time source for articles and information on web applications and development.

No Nonsense XML Web Development with PHP

The contents

No Nonsense XML Web Development with PHP covers a gamut of different topics, from an introduction on the basics of XML and its uses through to web services. Throughout, the straightforward and relaxed tone of the book help you to pick up the background behind what Thomas is teaching you, as well as the specifics of different aspects in the book.

We start off with a simple examination of XML and the role of DTDs in the consistency of the XML data. Thomas is right here to point out that DTDs are about consistency, rather than restriction, on the information we store in XML. He also covers the role that DTDs have in validating information, often simplifying the code required in our application to confirm the quality of the content.

Our first foray into the specifics of XML and PHP starts in Chapter 4 where the basics of the XSLT transformations are covered. This is also the start of a recurring theme in our application of a content management system (CMS). The book uses the CMS as a hook to link together all the different elements of the XML/PHP content and it is an approach which works well. This introduction is enhanced by a more detailed examination of XSLT before moving on to the manipulation of XMLwith JavaScript and the role of DHTML in web site development.

By Chapter 7 we are introduced to the full-blown techniques for parsing and manipulating XML data using PHP. We get in depth coverage on the different parsing techniques sich as SAX, DOM Thomas covers the fundamentals of parsing before covering the specifics of generating, and parsing, RSS/RDF information used in the syndication of web site data. The book then wraps up with coverage of web services, primarily XML-RPC and the role of databases in the use and storage of XML data.

Again, throughout, we get information and examples on how we can apply these different areas into our content management system. The entire CMS code is included in Appendix B of the book, with Appendix A holding information on the functions included in PHP for XML processing.

Pros

I like the conversational tone that Thomas uses - he doesn’t talk down to you and the concepts are introduced effectively through the use of a good progressive style and cross rereferences to other sections of the book. The use of a common goal project - the content management system - is also an excellent way to ensure that as you read through the contents, you pick up more of the detail and capabilities of PHP for XML.

The format of the book is good too - code sample are clearly defined (although the large font is a bit distracting) and each code extract is handily tagged with the file name and whether the fragment is entire or simply an extract. For each fragment there is usually a step by step examination of the code and a description of what is going on.

Cons

Very occasionally the theory of the topic being discussed seems to be a bit short and almost rushed. As a practical guide this isn’t a problem, but for some a better understanding of the theory would help with the adaptation of the practical contents. This shouldn’t really detract though from what is an excellent hands on guide to PHP and XML applications.

Recommendation

If you do any form of XML processing within PHP then this is the book you should keep on the shelf. Not only will it give you the back up theory you need, the practical examples will become invaluable.