给定以下XML文件,完成算法流程图。

 

  
    
< FileSystem >
< DriverC >
< Dir DirName =”MSDOS622”>
<File FileName =” Command.com” ></ File >
</ Dir >
< File FileName =”MSDOS.SYS” ></ File >
< File FileName =” IO.SYS” ></ File >
</ DriverC >
</ FileSystem >

 

请画出遍历所有文件名(FileName)的流程图(请使用递归算法)。
答:

 

  
    
void FindFile( Directory d )
{
FileOrFolders
= d.GetFileOrFolders();
foreach ( FileOrFolder fof in FileOrFolders )
{
if ( fof is File )
You Found a file;
else if ( fof is Directory )
FindFile( fof );
}
}

 

你可能感兴趣的:(xml)