How to validate xml using AIR recursively in folder

<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009" 
					   xmlns:s="library://ns.adobe.com/flex/spark" 
					   xmlns:mx="library://ns.adobe.com/flex/mx"
					   status="{Capabilities.os}"
					   alwaysInFront="true"
					   >
	
	<fx:Script>
		<![CDATA[
			import mx.charts.CategoryAxis;
			import mx.events.FlexEvent;
			import mx.utils.ObjectUtil;
			
			private var file:File;
			private var opts:NativeWindowInitOptions;
			private var win:NativeWindow;
			private var label:int = 0;
			protected function button1_clickHandler(event:MouseEvent):void
			{
				file = new File();
				file.addEventListener(Event.SELECT,fileSelect);
				file.browseForDirectory("Select Directory");
				//file.browseForOpen("select file");
			}
			
			protected function fileSelect(event:Event):void
			{
				// TODO Auto-generated method stub
				lbl.text = file.nativePath;	
				var directory:Array = file.getDirectoryListing();
				for each (var f:File in directory)
				{
					if(f.isDirectory){
						recrsiveFolderSearch(f);
					} else {
						processFile(f);
					}
				}
			}
			
			protected function recrsiveFolderSearch(file:File):void
			{
				var directory:Array = file.getDirectoryListing();
				for each (var f:File in directory)
				{
					if(f.isDirectory){
						recrsiveFolderSearch(f)
					} else {
						processFile(f);
					}
				}
			}
			
			private function processFile(file:File):void
			{
				if(file.url.indexOf(".xml") != -1){
					
					try{
						var fileStream:FileStream = new FileStream();
						fileStream.open(file, FileMode.READ);
						var prefsXML:XML = XML(fileStream.readUTFBytes(fileStream.bytesAvailable));
						fileStream.close();
						trace(file.nativePath)
					}catch(e:Error)
					{
						trace(e.message);
						trace("BUG : "+file.nativePath)
					}
					
				}
					
			}
			
			protected function button2_clickHandler(event:MouseEvent):void
			{
				// TODO Auto-generated method stub
				opts = new NativeWindowInitOptions()
				opts.type = NativeWindowType.LIGHTWEIGHT;
				win = new NativeWindow(opts);
				win.title = opts.type;
				win.activate();
			
			}
			
			/* protected function filesystemdatagrid1_creationCompleteHandler(event:FlexEvent):void
			{
				// TODO Auto-generated method stub
				fsDG.creationDateColumn.sortCompareFunction = createDateSortCompFunc("creationDate");
				fsDG.modificationDateColumn.sortCompareFunction = createDateSortCompFunc("modificationDate");
			} */
			
			private function createDateSortCompFunc(sortCol:String):Function {
				return function (obj1:File, obj2:File):int { 
					return ObjectUtil.dateCompare(obj1[sortCol], obj2[sortCol]);
				}
			}
			
		]]>
	</fx:Script>
	
	<fx:Declarations>
		<!-- Place non-visual elements (e.g., services, value objects) here -->
	</fx:Declarations>
	<mx:ApplicationControlBar dock="true">
		<s:Button label="Click to Browse" click="button1_clickHandler(event)" />
		<s:Button click="button2_clickHandler(event)" label="open window"/>
	</mx:ApplicationControlBar>
	<s:Label id="lbl" />
	<!--<mx:FileSystemDataGrid id="fsDG" sizeDisplayMode="bytes" 
						   directory="{File.userDirectory}"
						   creationComplete="filesystemdatagrid1_creationCompleteHandler(event)">
		
	</mx:FileSystemDataGrid>-->
</s:WindowedApplication>