在java中对XML数据应用一个或多个XSLT样式表
我希望能够对xml数据应用一个或多个sytle表。我有这段代码,我想知道如何修改它,以便在一个xml数据上应用尽可能多的样式表,并将结果打印在GUI的文本区域(我假定settext()只接受字符串),同时保存在文件中。这是我的密码。。多谢各位在java中对XML数据应用一个或多个XSLT样式表,java,xml,xslt,Java,Xml,Xslt,我希望能够对xml数据应用一个或多个sytle表。我有这段代码,我想知道如何修改它,以便在一个xml数据上应用尽可能多的样式表,并将结果打印在GUI的文本区域(我假定settext()只接受字符串),同时保存在文件中。这是我的密码。。多谢各位 /** * Constructor for objects of class Simple */ public Simple(String xmlFile, String xslFile,String outputFile)
/**
* 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 *****";
}
}
您需要转换过滤器链:阅读