Salve a tutti io ho questa classe:
Questa classe attraverso il main dovrebbe andare a scrivere su file ogni metodo di questa classe fa una cosa ed in tutti metodi in input prende un document.
Adesso io devo creare un arraylist contenente tutte le informazioni dei vari metodi e poi andare a scrivere su file...qualcuno saprebbe aiutarmi????heeelp!
public class ConsistentTest {

private String directory;
private DocumentBuilderFactory factory = null;
private Document xml = null;
private DocumentBuilder builder = null;

public ConsistentTest(){}

public Document caricaFile(String dirFile) throws IOException, SAXException,FactoryConfigurationError,ParserConfi gurationException
{
//dirFile="C:/Asynchronous/prova/Prova_test.xml";
try
{
factory = DocumentBuilderFactory.newInstance();
builder = factory.newDocumentBuilder();
xml = builder.parse( dirFile );

} catch( IOException ex ) {
System.out.println(ex.getMessage());
throw new IOException("IOException in caricaFile():\n"+dirFile);
} catch( SAXException ex ) {
throw new SAXException("SAXException in caricaFile():\n"+dirFile);
} catch( FactoryConfigurationError ex ) {
throw new FactoryConfigurationError("FactoryConfigurationErr or in caricaFile():\n"+dirFile);
} catch( ParserConfigurationException ex ) {
throw new ParserConfigurationException("ParserConfigurationE xception in caricaFile():\n"+dirFile);
}
return xml;
}

public void caseTestAction(Document test) throws MalformedURLException, FileNotFoundException, ProtocolException, IOException, TestException, SAXException, ParserConfigurationException, SOAPException{

CallWS call = new CallWS();
byte[] br = null;
String xmlFile ="";
String xmlFileName ="";
//String fileConsistent ="";
BufferedReader in = null;
Node root = test.getChildNodes().item(0);
String SOAPAction ="";
String SOAPEndPoint ="";
//String dir ="";
String xsdFile ="";
String fileOut ="";
int numtest =1;

if(root.hasChildNodes())
{
NodeList rootList = root.getChildNodes();

for (int id =0; id < rootList.getLength(); id++)
{
if(rootList.item(id) instanceof Node)
{
Node node = (Node)rootList.item(id);

if(node.hasAttributes())
{
NamedNodeMap namenode = node.getAttributes();

//requpero i dati relativi ad un singolo test
if(namenode.getNamedItem("SOAPAction")!= null)
SOAPAction = namenode.getNamedItem("SOAPAction").getNodeValue() ;
//chiamo il web service

/*if(xmlFileName != null && xmlFileName != "")
{
br = call.callWSfactory(SOAPEndPoint,SOAPAction,xmlFile );
in = call.callweb(br);
if(!ListFiles.isValidPath("C:/Asynchronous/prova/"+fileOut))
{
//il file non è presente lo creo
call.createFileOut(in,"C:/Asynchronous/",fileOut,xsdFile,false, numtest);
numtest++;
}
else if(ListFiles.isValidPath("C:/Asynchronous/prova/"+fileOut))
{
//il file è presente
call.createFileOut(in,"C:/Asynchronous/",fileOut,xsdFile,true, numtest);
numtest++;
}
}*/

}
}
}

}//end root if
}
public void caseTestEndPoint(Document test2){
//CallWS call = new CallWS();
//byte[] br = null;
//String xmlFile ="";
//String xmlFileName ="";
//String fileConsistent ="";
BufferedReader in = null;
Node root = test2.getChildNodes().item(0);
//String SOAPAction ="";
String SOAPEndPoint ="";
//String dir ="";
//String xsdFile ="";
//String fileOut ="";
//int numtest =1;

if(root.hasChildNodes())
{
NodeList rootList = root.getChildNodes();

for (int id =0; id < rootList.getLength(); id++)
{
if(rootList.item(id) instanceof Node)
{
Node node = (Node)rootList.item(id);

if(node.hasAttributes())
{
NamedNodeMap namenode = node.getAttributes();
if(namenode.getNamedItem("SOAPEndPoint")!= null)
SOAPEndPoint = namenode.getNamedItem("SOAPEndPoint").getNodeValue ();
}
}
}
}
}
public void caseTestDir(Document dr){
//CallWS call = new CallWS();
//byte[] br = null;
//String xmlFile ="";
//String xmlFileName ="";
//String fileConsistent ="";
BufferedReader in = null;
Node root = dr.getChildNodes().item(0);
//String SOAPAction ="";
//String SOAPEndPoint ="";
String dir ="";
//String xsdFile ="";
//String fileOut ="";
//int numtest =1;

if(root.hasChildNodes())
{
NodeList rootList = root.getChildNodes();

for (int id =0; id < rootList.getLength(); id++)
{
if(rootList.item(id) instanceof Node)
{
Node node = (Node)rootList.item(id);

if(node.hasAttributes())
{
NamedNodeMap namenode = node.getAttributes();
if(namenode.getNamedItem("dir")!= null)
dir = namenode.getNamedItem("dir").getNodeValue();
}
}
}
}

}
public void caseTestXml(Document dx){
//CallWS call = new CallWS();
//byte[] br = null;
String xmlFile ="";
String xmlFileName ="";
//String fileConsistent ="";
BufferedReader in = null;
Node root = dx.getChildNodes().item(0);
//String SOAPAction ="";
//String SOAPEndPoint ="";
//String dir ="";
//String xsdFile ="";
//String fileOut ="";
//int numtest =1;

if(root.hasChildNodes())
{
NodeList rootList = root.getChildNodes();

for (int id =0; id < rootList.getLength(); id++)
{
if(rootList.item(id) instanceof Node)
{
Node node = (Node)rootList.item(id);

if(node.hasAttributes())
{
NamedNodeMap namenode = node.getAttributes();
if(namenode.getNamedItem("xmlFile")!= null)
xmlFile =namenode.getNamedItem("xmlFile").getNodeValue();
}
}
}
}
}
public void caseTestXSD(Document dxsd){
//CallWS call = new CallWS();
//byte[] br = null;
//String xmlFile ="";
//String xmlFileName ="";
//String fileConsistent ="";
//BufferedReader in = null;
Node root = dxsd.getChildNodes().item(0);
//String SOAPAction ="";
//String SOAPEndPoint ="";
//String dir ="";
String xsdFile ="";
//String fileOut ="";
//int numtest =1;

if(root.hasChildNodes())
{
NodeList rootList = root.getChildNodes();

for (int id =0; id < rootList.getLength(); id++)
{
if(rootList.item(id) instanceof Node)
{
Node node = (Node)rootList.item(id);

if(node.hasAttributes())
{
NamedNodeMap namenode = node.getAttributes();
if(namenode.getNamedItem("xsdFile")!= null)
xsdFile =namenode.getNamedItem("xsdFile").getNodeValue();
}
}
}
}

}
public void caseTestCall(Document dcall) throws MalformedURLException, FileNotFoundException, ProtocolException, IOException, TestException, SAXException, ParserConfigurationException, SOAPException{
CallWS call = new CallWS();
ConsistentTest cs=null;
cs=new ConsistentTest();
byte[] br = null;
String xmlFile ="";
String xmlFileName ="";
//String fileConsistent ="";
BufferedReader in = null;
Node root = dcall.getChildNodes().item(0);
String SOAPAction ="";
String SOAPEndPoint ="";
//String dir ="";
String xsdFile ="";
String fileOut ="";
int numtest =1;

if(root.hasChildNodes())
{
NodeList rootList = root.getChildNodes();

for (int id =0; id < rootList.getLength(); id++)
{
if(rootList.item(id) instanceof Node)
{
Node node = (Node)rootList.item(id);

if(node.hasAttributes())
{
//NamedNodeMap namenode = node.getAttributes();
if(xmlFileName != null && xmlFileName != "")
{
br = call.callWSfactory(SOAPEndPoint,SOAPAction,xmlFile );
in = call.callweb(br);
if(!ListFiles.isValidPath(getDirectory()+fileOut))
{
//il file non è presente lo creo
call.createFileOut(in,"C:/Asynchronous/",fileOut,xsdFile,false, numtest);
numtest++;
}
else if(ListFiles.isValidPath(getDirectory()+fileOut))
{
//il file è presente
call.createFileOut(in,"C:/Asynchronous/",fileOut,xsdFile,true, numtest);
numtest++;
}
}
}
}
}
}
}
public void caseTestReq(Document dreq){
//CallWS call = new CallWS();
//byte[] br = null;
//String xmlFile ="";
String xmlFileName ="";
//String fileConsistent ="";
//BufferedReader in = null;
Node root = dreq.getChildNodes().item(0);
//String SOAPAction ="";
//String SOAPEndPoint ="";
//String dir ="";
//String xsdFile ="";
//String fileOut ="";
//int numtest =1;

if(root.hasChildNodes())
{
NodeList rootList = root.getChildNodes();

for (int id =0; id < rootList.getLength(); id++)
{
if(rootList.item(id) instanceof Node)
{
Node node = (Node)rootList.item(id);

if(node.hasAttributes())
{
NamedNodeMap namenode = node.getAttributes();
if(namenode.getNamedItem("requestFileName")!= null)
xmlFileName =namenode.getNamedItem("requestFileName").getNodeV alue();
}
}
}
}
}
public void caseTestFile(Document dfile){
//CallWS call = new CallWS();
//byte[] br = null;
//String xmlFile ="";
//String xmlFileName ="";
//String fileConsistent ="";
BufferedReader in = null;
Node root = dfile.getChildNodes().item(0);
//String SOAPAction ="";
//String SOAPEndPoint ="";
//String dir ="";
//String xsdFile ="";
String fileOut ="";
//int numtest =1;

if(root.hasChildNodes())
{
NodeList rootList = root.getChildNodes();

for (int id =0; id < rootList.getLength(); id++)
{
if(rootList.item(id) instanceof Node)
{
Node node = (Node)rootList.item(id);

if(node.hasAttributes())
{
NamedNodeMap namenode = node.getAttributes();
if(namenode.getNamedItem("fileOut")!= null)
{
fileOut =namenode.getNamedItem("fileOut").getNodeValue();
fileOut =fileOut.replace(".xml",".txt");
}
}
}
}
}
}
public static void main(String args[]) throws IOException, SAXException, FactoryConfigurationError, ParserConfigurationException, TestException, SOAPException{
ConsistentTest cs = null;
Document dc=null;
cs=new ConsistentTest();
cs.caricaFile(args[0].toString());


NON SO COME CONTINUARE!!!!HEEEEEEEEEELLP!


}

public String getDirectory() {
return directory;
}

public void setDirectory(String directory) {
this.directory = "C:/Asynchronous/prova";
}
}



HEELP!!