i want to be able to apply one or more sytle sheets on an xml data. i have this code and i am wondering how i can modify it so i can apply as many style sheets on a single xml data and the result be printed on the text area of a GUI ( as i presume settext() accepts only strings) and saved on a file at the same time. these are my codes.. thank you
我希望能够在xml数据上应用一个或多个sytle表。我有这个代码,我想知道如何修改它,以便我可以在单个xml数据上应用尽可能多的样式表,结果将打印在GUI的文本区域(因为我认为settext()只接受字符串)和同时保存在文件中。这些是我的代码..谢谢
/**
* Constructor for objects of class Simple
*/
public Simple(String xmlFile, String xslFile,String outputFile)
{
this.xmlFile = xmlFile;
this.xslFile = xslFile;
this.outputFile= outputFile;
}
public String SimpleTransform() 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 = "***The result is in birds.out *****";
}
}
1 个解决方案
#1
1
You need transformation filter chain: Read Concatenating Transformations with a Filter Chain
您需要转换过滤器链:使用过滤器链读取连接转换
#1
1
You need transformation filter chain: Read Concatenating Transformations with a Filter Chain
您需要转换过滤器链:使用过滤器链读取连接转换