Without knowing what the target XML is supposed to look like and what information is needed to be captured, here's a guess:
#!/bin/bash.exe
echo $'<?xml version="1.0" encoding="utf-8"?>\n<dirlist>' > directory_list.xml
find . -type d -exec echo "<dir>{}</dir>" \; >> directory_list.xml
echo "</dirlist>" >> directory_list.xml
(The bash.exe is because I'm on Cygwin.)
Here's a listing of the "tools" directory in my oXygen install dir:
directory_list.xml
<?xml version="1.0" encoding="utf-8"?>
<dirlist>
<dir>.</dir>
<dir>./.svn</dir>
<dir>./.svn/prop-base</dir>
<dir>./.svn/props</dir>
<dir>./.svn/text-base</dir>
<dir>./.svn/tmp</dir>
<dir>./.svn/tmp/prop-base</dir>
<dir>./.svn/tmp/props</dir>
<dir>./.svn/tmp/text-base</dir>
<dir>./ant</dir>
<dir>./ant/.svn</dir>
<dir>./ant/.svn/prop-base</dir>
<dir>./ant/.svn/props</dir>
<dir>./ant/.svn/text-base</dir>
<dir>./ant/.svn/tmp</dir>
<dir>./ant/.svn/tmp/prop-base</dir>
<dir>./ant/.svn/tmp/props</dir>
<dir>./ant/.svn/tmp/text-base</dir>
<dir>./ant/bin</dir>
<dir>./ant/etc</dir>
<dir>./ant/etc/checkstyle</dir>
<dir>./ant/lib</dir>
<dir>./config</dir>
</dirlist>