Without knowing Perl and it's methods for reading directories or handling XML this is a bit of pseudocode you could use as a template:
strFileExtensionToMap="jpg"
strNodeName="image"
strCollectionName="images"
currentXMLNode=XML.CreateElement(strCollectionName)
StartFolder=Filesystem.GetFolder([however to get folder])
Call RecursiveMapContents(StartFolder)
RecursiveMapContents(folder){
For each file in folder.Files
{
if (file.extension=strFileExtensionToMap)
xmlFile=XML.CreateElement(strNodeName)
big_Url=XML.CreateElement("big_url)
big_url.text=file.path
xmlFile.AppendChild(big_url)
currentXMLNode.AppendChild(xmlFile)
}
For each subFolder in folder.Folders
{
call RecursiveMapContents(subFolder)
}
}
Of course, you could make the XML more generic by using file type as an attribute of a file element:
<file type="image"/>
You could also map the actual nested directory structure by using
<folder name="foldername" path="folderpath"> instead of <images>
Then you could include the current folderNode in your call to RecursiveMapContents, so that files and subfolders were nested within it, giving you:
<folder name="foldername" path="folderpath">
<file type="image">
<big_url>file path</big_url>
</file>
<file type="image">
<big_url>file path</big_url>
</file>
<folder name="foldername" path="folderpath">
<file type="image">
<big_url>file path</big_url>
</file>
<file type="image">
<big_url>file path</big_url>
</file>
</folder>
</folder>
I didn't include the namespaces, though I'll admit to being somewhat mystified as to why you'd want separate namespaces for images and pdfs. The point of a namespace is to provide unique naming for a set of elements (so someone else's image element isn't confused with your image element should you want to work with their XML). If you really need a namespace at all then "http://mydomain.com" should be enough for all your element names. A namespace says "this element, which we use shorthand image for is actually called thisnamespace:image". So unless you have two types of image element (one in pdfs, the other in images) and they aren't equivalent the single namespace is enough.
There's also a lot more you could do to make your XML more generic, and possibly less verbose. It's largely up to whoever designs the XML format to specify whether something like a filepath should be an attribute of a file element or a child element (like your big_url), it depends on whether the data needs to be qualified (e.g. filepath="this filepath" type="filesystem|http" should use a child element).
Sorry it's not a Perl answer, but I hope it helps.