because using standards should be easy
This page was last updated
Friday 3 October 2003
|
Home
XML Application Objects (XAO) is a simplified, unified API for working with XML in
PHP. It is
designed to accelerate standards based development of object oriented
web applications in PHP.
The XAO concept in a nutshellXAO is a class libraryThe main classes stand on their own so that you can use them as utilities. The other classes in the library are designed to be inherited from and not used directly. XAO can be used as a framework - it's primary functionXAO also provides a framework where you really only need to understand about 2 or 3 classes in order to build medium to large-scale applications. Most of the other classes in the library are facilitators for the framework. Tutorials provide the best advice on how to use the XAO framework. The XAO framework uses a Content Aggregation patternXML is a specification for encapsulating data - our content in this case. Web applications are composed of pieces of content. In XAO, there is a foundation class which represents any such piece of content - the DomDoc class. All of your content is based on classes derived from this class. This class contains methods which allow you to consume more [XML based] content from various sources including other DomDoc based (child class) object instances. These consume methods aggregate XML content and graft them into the XML document contained by the object that is doing all the consuming. The Application Object is the master documentThe application object - AppDoc, is derived from DomDoc so it is an XML content object with all of the consume capabilities. AppDoc is the equivalent of a master document for any PHP script. Usually, it's the one that's doing all the content aggregation. At the end of the script when it has all the content it needs, it then sends all of it's contents (payload) using a Send() method. Optionally (usually) it can run the Transform() method just prior to the Send(). XAO provides classes for content fragmentsWith XAO, most of the application developer's work is concerned with providing the bits of content that their AppDoc [or derivative of] object consumes. The most common content source being a relational database. DbToXml is a derivative of the DomDoc class so it is a content based class. DbToXml provides a facility to convert SQL database result sets into XML content which it then represents because it is a content object. The DbToXml object instance can then be consumed by the AppDoc [or derivative of] object instance. DbToXml is a powerful class with the ability to mutate it's content tree through the usage of user-defined call-back functions. As mentioned before, the application object can consume various other sources - including flat files and other XML fragment data. Under development is the ability to get content from pure XML databases such as Xindice. These XAO classes will yet again remove implementation detail of the underlying process to yield a high-level API for data access. You can use XSLT for templatingTransform() converts the source XML using XSLT. AppDoc allows you to specify an XSL stylesheet at runtime which you then use as a template (the view if you want to use an MVC pattern). So you are not restricted to HTML, you can pump out any format that your XSL template can produce. XAO provides nice debugging output for XSL template development. Short code example
<?php
That's itThat's the XAO framework concept in a nutshell. You can start simple and the complexity can scale from there. A good place to start from here would be to check out the introductory tutorial. |
This website is copytight Terence Kearns 2003 The XML Application Objects library is copyright Terence Kearns 2003 and made freely available to the public via the Lesser General Public Licence (LGPL). The hosting of this project is generously provided by sourceforge.net |