Jsp Xerces Checker Loop Plugin Java

From Fxp Wiki

Jump to: navigation, search
 
package vendo;
 
import vendo.XercesChecker;
import java.io.*;
import java.io.Writer;
import java.io.File;
import com.ecyrd.jspwiki.WikiContext;
import java.util.Map;
import com.ecyrd.jspwiki.plugin.WikiPlugin;
import com.ecyrd.jspwiki.plugin.PluginException;
 
public class XercesCheckerLoopPlugin implements WikiPlugin
{
	StringBuffer output = new StringBuffer();
		
    public String execute(WikiContext context,
                          Map params)
        throws PluginException
    {
	
	    String message="";
        // Get the names of the directory to loop through
        String dirName = (String)params.get( "dir" );
	String monresult="";
 
    try {
		File dirObj = new File (dirName);
		if (dirObj.exists() == true) {
			if (dirObj.isDirectory() == true) {
				// Create an array of File objects, one for each file or directory in dirObj.
				File [] fileList = dirObj.listFiles();
				// Display Source Directory Name.
				output.append("Source Directory: "+dirName);
				// Loop through File array and display.
				
				for (int i = 0; i < fileList.length; i++) {
						// Print the path to each file.
						String filepath = new String(fileList[i].getPath());
						output.append ("<br />D�b:" + fileList[i].getPath() + "Fin<br />" );
						XercesChecker xc = new XercesChecker(filepath);
						output.append (xc);
				} // for loop 
			} else { output.append (dirName+" is not a directory."); }
		} else { output.append ("Directory "+dirName+" does not exist."); }
	monresult =  output.toString();
	}
	catch(Exception e){}
   return monresult;	
   }
}
 
Personal tools