for modern web applications
This page was last updated Wednesday 24 September 2003
Knowing the aims and objectives of XAO should help you understand how to use the code because you will understand the intent. This page shows the aims of the project. The concrete objectives are found in the project task lists and road map.
If you are a PHP developer, you might be thinking "There has to be an easier way to build XML/XSLT applications in PHP". Well, you'd be right, there is, and XAO is here to make that happen. XAO is one of those solutions which has come about as a result of an effort to remove the tedium associated with programming to the various APIs that PHP offers for XML functionality.
Aims of the XAO project
A web developer should be able to hit the ground running with XAO. The library is designed to present a simple interface to high-level functionality in XML and XSLT.
Standards based development:
Hopefully the simplicity offered by XAO will encourage more developers to build standards based applications. For instance, not using proprietary templating systems - forcing end users to learn a new templating language every time they want to re-skin a new PHP app they downloaded. They can use and re-use XSLT templates which are a W3C standard.
Since XAO is simply a library, the web developer can use whatever architecture they feel is appropriate for their projects. XAO provides the option of using it in framework mode, and even then, applying a model-view-controller pattern is optional.
While you can start off simple with XAO, as the needs of an application become more complex, you can start taking advantage of the more powerful aspects of the API. For instance, you can define call-back functions in situations where enhanced processing is required. You can take advantage of the OO design of the library and use inheritance to extend/customise functionality. Most of the XAO objects where designed to be extended.
A short illustration of how simplicity is achieved
Before we look at an example of using XAO code, here is an example of a simple XML/XSLT script written in PHP and not using XAO...
This is what the same code would look like in XAO...
Notice that not only are there less lines of code, but it is also object oriented. As the name suggests, XAO is a class repository for people wanting to build object oriented applications. XAO helps to make it easier to tame the proceduralness of the PHP XML API to your object oriented design.
Using the XAO library in the fashion shown above turns each PHP page into
the equivalent of the
In case you're wondering about the example, you can still access the full standard range of dom methods without choosing to use the XAO shortcuts. Instead of doing...
You could have done...
The choice is yours.
XAO is all about speeding up the process, it's not about dictating how you should do things. If you see a need for a shortcut that XAO doesn't support you simply inherit the XAO object and add the member function to your own class. Most of the XAO classes are designed primarily to be extended by you.
In tackling the original example, one could write some functions to act as shortcuts but you'll probably end up being in danger of repeating much of the work put into XAO. Why would every PHP developer want to write his/her own library of functions/objects in isolation if the functionality is generic [to XML in this case]? Wouldn't it be nice if you could leverage the work done by someone else? Using XAO can save you time and engergy spent on "the boring bits" so that you can spend more time writing code directly related to buisness outcomes rather than application infrastructure.
Its worth mentioning that XAO can work with other PHP libraries such as PEAR and phplib. XAO is a stand-alone library so that all the classes work together in harmony for a single purpose - to make developing 100% object oriented XML applications easy.
The XAO example shown above demonstrates XAO working in "framework mode". Note that it is possible to continue to use your own application framework and merely use XAO objects for convenient access to high-level XML functionality.
The XAO project will focus strongly on knowledge support by providing numerous tutorials (how-tos) as well as other documentation including awareness articles on this site. There are tutorials to illustrate simples tasks as well as suggestive tutorials on how one might approach large-scale application design using XAO as in framework mode. This documentation complements a full API reference which is generated by the JavaDoc style comments embedded in the library code itself. The user community is invited to contribute tutorials/articles for techniques that they may have developed independantly.