Dir2XML is a library for generating an XML file that represents a directory structure. Example input file:

<?xml version="1.0"?>

<document xmlns:dx="http://dir2xml.sourceforge.nl/XMLNS">
   <dx:dir2xml dir="/home/ernst/public_html" />

After being processed by the Dir2XML processor, the result would be something like:

<?xml version="1.0"?>

   <dir name="public_html" year="2002" month="3" day="15" hour="19" minute="54" second="12">
      <file name="index.html" size="3048" year="2002" month="4" day="3" hour="22" minute="16" second="4" />
      <file name="img.gif" size="4096" year="2002" month="4" day="3" hour="23" minute="04" second="0" />

Support for Ant is provided. Example of a target that will perform Dir2XML processing:

<target name="dir2xml">
   <taskdef name="dir2xml" classname="org.znerd.dir2xml.ant.Task">
      <classpath path="dir2xml.jar" />
      <classpath path="jdom.jar" />
      <classpath path="xercesImpl.jar" />
      <classpath path="xmlParserAPIs.jar" />

   <dir2xml in="in.xml" out="out.xml" encoding="ISO-8859-1" newlines="true" indent="   "/>

Dir2XML is managed using SourceForge. The SourceForge project name is dir2xml.

The latest release version of Dir2XML is 0.3.

Downloads and links

Downloads are distributed as .tar.gz files. There are 2 distributions. The first contains only the source files and everything else that is necessary for generating the rest. The second contains generated class files, a JAR file and API documentation as well.

Downloads can be obtained from SourceForge:

The generated API documentation is available online here:

The CVS repository can be browsed online:


If you would like to contact the author, feel free to send an email to: