服务器端解析XML
老土豆T 2003-12-04 01:33:57 <%@ page contentType="text/html; charset=gb2312"%>
<%@ page import="org.w3c.dom.*" %>
<%@ page import="javax.xml.parsers.*"%>
<%@ page import="java.io.*"%>
<%@ page import="javax.xml.transform.*"%>
<%@ page import="javax.xml.transform.stream.*"%>
<%
StringReader reader=new StringReader("ZCML.xml");
StreamSource xml = new StreamSource(reader);
String path = application.getRealPath("/xtsd/zcml/xml/XmlRes");
System.out.println(path);
StreamSource xsl = new StreamSource(path+"/XMLSelTree.xsl");
StreamResult result = new StreamResult(out);
TransformerFactory tFactory = TransformerFactory.newInstance();
Templates templates = tFactory.newTemplates(xsl);
Transformer trans = templates.newTransformer();
trans.setOutputProperty(OutputKeys.ENCODING,"GB2312");
trans.setOutputProperty(OutputKeys.METHOD,"html");
trans.setOutputProperty(OutputKeys.VERSION,"4.0");
trans.transform(xml, result);
%>
抛出 一个 org.apache.jasper.JasperException: The output format must have a '{http://xml.apache.org/xalan}content-handler' property!
客户端解析是好的。。这个是什么异常,谢谢各位!