Directory Generator
http://xml.apache.org/http://www.apache.org/http://www.w3.org/

Main
User Documentation

Generators
Overview

Default
File Generator

Core
HTML Generator
Directory Generator
Image Directory Generator
Fragment Extractor Generator
JSP Generator
Script Generator
Server Pages Generator
Velocity Generator
Request Generator
Status Generator
Stream Generator
Profile Generator
Error Generator
Search Generator
LinkStatus Generator
Web Service Proxy Generator
Text Parser Generator

Optional
Php Generator
XML:DB Generator
XML:DB Collection Generator

Directory Generator

Generates an XML directory listing.

The root node of the generated document will normally be a directory node, and a directory node can contain zero or more file or directory nodes. A file node has no children. Each node will contain the following attributes:

  • name : the name of the file or directory
  • lastModified : the time the file was last modified, measured as the number of milliseconds since the epoch (as in java.io.File.lastModified)
  • size : the file size in bytes (as returned by java.io.File.length)
  • date (optional) : the time the file was last modified in human-readable form

All generated elements have the namespace http://apache.org/cocoon/directory/2.0. The root directory node has the attribute requested with the value true. The sort order is described by the attribute sort, which defaults to sorting according to name.

  • Name : directory
  • Class: org.apache.cocoon.generation.DirectoryGenerator
  • Cacheable: no.
<map:generate type="directory" src="the_directory"/>
Configuration

The following parameter can be specified in the pipeline for the generate command:

  • depth (optional) : Sets how deep Directory Generator should delve into the directory structure. If set to 1 (the default), only the starting directory's immediate contents will be returned.
  • dateFormat (optional) : Sets the format for the date attribute of each node, as described in java.text.SimpleDateFormat. If unset, the default format for the current locale will be used.
  • root (optional) : The root pattern. This is a regular expression as described here.
  • include (optional) : The include pattern. Also a regular expression.
  • exclude (optional) : The exclude pattern. Also a regular expression.
  • sort (optional) : This parameter determines the order in which the file and directory nodes are returned. Default sort order is as defined by the system. Possible values are "name", "size", "time", and "directory". "directory" is the same as "name", except that directory entries are listed first.
  • reverse (optional) : This parameter reverses the sort order. reverse="false" is the default.
DTD

XML generated by directory generator uses namespace http://apache.org/cocoon/status/2.0. The DTD of XML generated by directory generator:

<!ELEMENT directory (directory|file)*>
<!ATTLIST directory
    name         CDATA #REQUIRED
    lastModified CDATA #REQUIRED
    date         CDATA #IMPLIED
    size         CDATA #IMPLIED
    sort         CDATA #IMPLIED
    reverse      CDATA #IMPLIED
    requested    CDATA #IMPLIED>

<!ELEMENT file #EMPTY>
<!ATTLIST file
    name         CDATA #REQUIRED
    lastModified CDATA #REQUIRED
    date         CDATA #IMPLIED
    size         CDATA #IMPLIED>
Example

The current directory generator may generate following xml:

<dir:directory xmlns:dir="http://apache.org/cocoon/directory/2.0"
    name="stylesheets"
    lastModified="1019666489000"
    date="24.04.02 18:41"
    size="461"
    sort="name"
    reverse="false"
    requested="true">
    <dir:directory name="sites" lastModified="1019666489000"
        date="24.04.02 18:41" size="118"/>
    <dir:file name="dynamic-page2html.xsl" lastModified="1019666489000"
        date="24.04.02 18:41" size="1832"/>
    <dir:file name="simple-xml2html.xsl" lastModified="1019666489000"
        date="24.04.02 18:41" size="12676"/>
</dir:directory>
            
Copyright © 1999-2002 The Apache Software Foundation. All Rights Reserved.