服务器端解析XML

老土豆T 老土豆T 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
<%@ 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!


客户端解析是好的。。这个是什么异常,谢谢各位!
...全文

相关推荐

评论 6
收藏 已收藏
分享
返回顶部
老土豆T
Web 开发 81,108 成员 341,721 内容