TraversableGenerator
Summary
Generates an XML source hierarchy listing from a Traversable Source.
Basic information
Component type | Generator |
---|---|
Cocoon block | core |
Java class | org.apache.cocoon.generation.TraversableGenerator |
Name in Sitemap | |
Cacheable | Yes - Yes |
Documentation
The root node of the generated document will normally be a collection node and a collection node can contain zero or more resource or collection nodes. A resource node has no children. Each node will contain the following attributes:
- name the name of the source
- lastModified the time the source was last modified, measured as the number of milliseconds since the epoch (as in java.io.File.lastModified)
- size the source size, in bytes (as in java.io.File.length)
- date (optional) the time the source was last modified in human-readable form
Note: The TraversableGenerator can browse block defined in the Servlet
Service Framework in addition to the resources in the current block.
Configuration options:
- depth (optional) Sets how deep TraversableGenerator should
delve into the source hierarchy. If set to 1 (the default), only the starting
collection's immediate contents will be returned.
- sort (optional) Sort order in which the nodes are returned. Possible values are name, size, time, collection. collection is the same as name, except that the collection entries are listed first. System order is default.
- reverse (optional) Reverse the order of the sort
- 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.
- timeZone (optional) Sets the time zone offset ID for the date attribute, as described in java.util.TimeZone. If unset, the default system time zone will be used.
- refreshDelay (optional) Sets the delay (in seconds) between checks on the source hierarchy for changed content. Defaults to 1 second.
- root (optional) Sets the the regular expression for the root pattern.
- include (optional) Sets the the regular expression for including sources based on their names.
- exclude (optional) Sets the the regular expression for excluding sources based on their names.
Example:
<map:match pattern="pages.xml"> <map:generate type="traversable" src="blockcontext:/"> <map:parameter name="depth" value="4"/> <map:parameter name="include" value="wsmain$|resource$|basepage$|\.(.+)"/> <map:parameter name="exclude" value="xsl$|xmap$"/> </map:generate> <map:serialize type="xml"/> </map:match>