DirectoryGenerator

Directory generators read a specified directory and present it to the pipeline as an XML document for processing. So a typical use of DirectoryGenerator would be:

<map:generators default="file"> <map:generator name="directory" src="resource://lib/generation/DirectoryGenerator"/> ... </map:generators> <map:pipelines> <map:pipeline> <map:match pattern="get-dir.html"> <map:generate type="directory" src="context://resources"> <map:parameter name="depth" value="2"/> <map:parameter name="dateFormat" value="F d Y H:i:s"/> <map:parameter name="include" value="/.*/"/> <map:parameter name="exclude" value="/.+\.xmap/"/> <map:parameter name="reverse" value="false"/> </map:generate> <map:call resource="xml2xhtml"/> </map:match> </map:pipeline> </map:pipelines>

where

The example above injects the following typical XML into the pipeline (taken from the Paloose directory):

<dir:directory name="/Library/Apache2/htdocs/pp/resources" lastmodified="April 02 2007 11:24:09" reverse="false" requested="true" size="306" xmlns:dir="http://apache.org/cocoon/directory/2.0"> <dir:directory name="/Library/Apache2/htdocs/pp/resources/transforms" lastmodified="April 23 2007 10:21:06" size="1428"> <dir:file name="xml2rss.xsl" lastmodified="April 02 2007 11:24:11" size="3330"/> <dir:file name="xml2xhtml.xsl" lastmodified="April 02 2007 11:24:11" size="8018"/> ... <dir:file name="admin-buildAuthenticateDOM.xsl" lastmodified="April 02 2007 11:24:11" size="3322"/> <dir:file name="admin-addUser.xsl" lastmodified="April 02 2007 11:24:11" size="2606"/> </dir:directory> ... <dir:directory name="/Library/Apache2/htdocs/pp/resources/images" lastmodified="April 02 2007 11:24:13" size="1258"> <dir:file name="wcag1AA.png" lastmodified="April 02 2007 11:24:12" size="2288"/> <dir:file name="w3c_ab.png" lastmodified="April 02 2007 11:24:12" size="1296"/> <dir:file name="vcss.png" lastmodified="April 02 2007 11:24:12" size="1134"/> ... <dir:file name="RSS.gif" lastmodified="April 02 2007 11:24:13" size="451"/> <dir:file name=".DS_Store" lastmodified="December 03 2006 19:47:42" size="6148"/> </dir:directory> </dir:directory>

where

If the results of the scan are empty a single element is returned to indicate an empty scan:

<dir:directory ... > <dir:empty> </dir:directory>
Copyright 2006 – 2024 Hugh Field-Richards. All Rights Reserved.