単純な変換を行うオブジェクトがあります。XMLデータをCSVに変換するスタイルシートを作成しました。変換後、CSVファイルが作成されますが、内容は空です。
public class Simplex
{
private String xmlFile ;
private String xslFile;
private String outputFile;
/**
* Constructor for objects of class Simple
*/
public Simplex(String xmlFile, String xslFile,String outputFile)
{
this.xmlFile = xmlFile;
this.xslFile = xslFile;
this.outputFile= outputFile;
}
public String simplexTransform() throws
TransformerException,TransformerConfigurationException,FileNotFoundException,
IOException
{String mystring = "";
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer = tFactory.newTransformer(new StreamSource(xslFile));
transformer.transform(new StreamSource(xmlFile), new StreamResult(new
FileOutputStream(outputFile)));
return mystring = "*Data Has Been Transformed,Check ouput File *";
}
}