Reading filenames with extension .xml

Hi,

I want to write a script to read all the filenames with extension .xml in a directory and pass the name of the file, one by one, to another function.

Please help me out.

Regards.
Saurabh

for file in /path/to/*.xml
do
grep stuff $file
done

As a warning, xml can be tricky to handle for various reasons:
1) it could all be on a single line - which means many unix utilities will not handle properly.
2) white space between tags is totally allowed, or optional (see #1)
3) It could be in "uni-code" which means there could be binary zeroes between every other character.

so have fun with the variations.

ls *xml | while read -r file
do
function $file
done