Chapter 15
Two Way XML
This chapter extends the functionality we learned in the last. We have uploaded an XML structure to the server in a stable and authentic manner - but we have not really read the file on the server side.

Now we will introduce PHP’s XML functions. We will learn to distinguish event-driven parsers from the tree parsers we have already used, and we will build one of the former on the server. With it, we will digest the data sent from Flash and formulate an appropriate response.

We will develop the Flash client that interacts with this PHP script. The client delivers an XML data object to the server. The server parses the XML and responds. Flash receives and parses this XML response.

Introduction

PHP’s core XML functions are built upon expat, a seminal open-source XML parser published by Jim Clark. It is an event driven parser, and does an excellent job within its limited scope. It can unwind the syntax of an XML string: identifying each of its components and elaborating its external references. The parser does not validate XML. Nor does it maintain any sense of state that we would find useful.