To use the tasks, you will need to add geof-ant.jar to your classpath, and specify them in your build file. I have shown the standard names I use. Here's the relevant snippet of my build file. You can find a complete working build file in teh example site included with the code.
<taskdef name="xmlconcat" classname="net.geof.ant.XmlConcat"/>
<taskdef name="xmlsplit" classname="net.geof.ant.XmlSplit"/>
<taskdef name="listfiles" classname="net.geof.ant.XmlFileLister"/>
xmlconcat (net.geof.ant.XmlConcat)
This task processes a set of XML files using an XSLT stylesheet and produces a concatenated output file. It is useful for building an index of documents.
Parameters
- destfile
- The name of the output XML file. Required.
- stylesheet
- An XSLT stylesheet to run on each file. Required.
- rootNode
- The name of the root node for the output document. Defaults to "files".
- filepath - the path to the file (may not be absolute)
- filesystem - the absolute system path to the file
- filedir - the path to the file (not including the filename)
- filename - the file name (including extension)
- filebasename - the file basename
- fileextension - the file name extension
- path - the relative path to the file, including directory and file
- dir - the file directory path, excluding the file name itself
- name - the file name, including any extension but excluding the directory path
- extension - the file extension
- basename - the file name excluding the extension
- system - the absolute system path to the file
- digest - produce a SHA1 digest of the file's contents
- dirs - include directories in the listing
The stylesheet is passed a number of parameters for each document. These are:
xmlsplit (net.geof.ant.XmlSplit)
This task scans the input document until it encounters an element with the name set by the filetag attribute in ant. It then creates an output file. The name of the output file is taken by using the value of the nameAttribute attribute of that element and adding on the extension.
Here is an example usage of this task:
<xmlsplit in="${work}/index-file-list.xml" dir="${work}/photos"
extension=".list" fileTag="list" dirAttribute="filedir"
nameAttribute="id" includeRoot="true"/>
Given a document looking like this:
<root>
<list filedir="." id="foo">Hello World</list>
</root>
The ant task will generate a single output document named "foo.list" looking like this:
<code>
<list filedir="." id="foo">Hello World</list>
listfiles (net.geof.ant.FileLister)
The file lister generates an XML file describing a directory tree and the contained files. For example, for a single file found in www/images/red.gif under the scanned directory d:\internet, the following would be the output:
<root>
<file path="www/images" name="red.gif" basename="red"
extension=".gif" href="www/images/red.gif"/>
</root>
Use XmlConcat instead when you want to run an XSL stylesheet on each file being listed.
It is possible specify exactly which output fields are desired, e.g.:
<listfiles fields="path name extension">
Here is the complete list of fields:
You appear to be using Internet Explorer. You may therefore have difficulty navigating this site. More Information...