hope, this is the right place to post.
I made some changes to the DirectoryGenerator (1) and HTMLGenerator (4) and introduced a PipelineDirectoryGenerator(2) and FileInfoGenerator (3) for convenience.
my aim was to scan a directory for (Html,XML-)articles, extract the titles from the files and show a overview site to the user.
I dont know, if this is interesting for You, where to post the code/example for review, how to name the packages/classes.
best regards, alfred
(1) ==================== made some extensions to the DirectoryGenerator: (all can be switched on and off, so the new Generator behaves as the old one when no optinal parameterers are given)
- it is now possible recursing directories, even when the pattern is not matching the directory name. - directories with no matching files, can be excluded from the resultset. - matching directories can be added to the resultset (<dir:file type="directory"..../>) - the sort order can now be a whitespace separated list, so you can also define ordering on the second, third... level.
(2) ==================== introduced a PipelineDirectoryGenerator: the content of the <dir:file>-tag is the result of a matching pipline:
<map:generate type="pipeline-directory" src="."> <map:parameter name="include" value="\.(xml|html|jpg|gif|png)$" /> <map:parameter name="mimeTypePipeline" value="cocoon:/mime-type-directory" /> </map:generate>
<map:match pattern="mime-type-directory**"> <map:match pattern="mime-type-directory/**.xml"> [...] </map:match> <map:match pattern="mime-type-directory/**.html"> [...] </map:match> [...] </map:match>
(3) ==================== introduced a FileInfoGenerator: only extracted some pice of code from the ImageDirectoryGenerator and added some additional code.
(4) ==================== made a patch to the HTMLGenerator (I always got a NullPointerException on xhtml documents with <?xml ....?> in the header.)
changed: streamer.stream(doc);
to: this.contentHandler.startDocument(); streamer.stream( doc.getDocumentElement() ); this.contentHandler.endDocument();
(would it not be better, move this down to the DOMStreamer?)