Exploring PHP XML handling
From the outset, we committed ourselves to PHP 5. Extension handling requires that XML be processed, as the means to define how a particular extension should be installed. Fortunately, PHP 5 greatly improves the XML handling tools available to us.
The easy way to parse the XML belonging to an extension is to employ the PHP 5 SimpleXML facility. The XML is loaded and turned into a set of objects by SimpleXML. The provided objects can be processed by simple mechanisms such as iteration and subscripting.
To see what can be done, consider the moderately complex XML shown in Appendix B, which is used for packaging the Aliro component that handles login and user management. It is actually an application, and incorporates three modules and a plugin.
The whole of the XML can be loaded and parsed just by calling the simplexml_load_file
function. Given my strong orientation towards standards, I favor setting options in the call to include LIBXML_DTDVALID
, which will cause...