假设我有以下代码:
void validate(File f) //or boolean?????
{
...
try
{
//try to validate xml file
}
catch (Exception e)
{
}
}
...
try
{
validate(xml_file); //validates XML file
move(xml_file, valid_folder); //moves valid XML file to valid_folder
}
catch (Exception e)
{
move(xml_file, error_folder); //moves invalid XML file to error_folder
}
...
我的validate()
功能应该是boolean
,我应该检查文件是否是有效的 XML 文件,还是catching
会为我做?