在JAVA中使用transform操纵XSLT报错: RuntimeStub::init_check_patching Runtime1 stub
在网上找了一个JAVA操纵XSLT的例子:
功能是输出XML经过XSLT转换后的结果.
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamSource;
import javax.xml.transform.stream.StreamResult;
import java.io.*;
public class Transform {
/**
* Performes an XSLT transformation, sending the results
* to System.out.
*/
public static void main(String[] args) throws Exception {
if (args.length != 2) {
System.err.println(
"Usage: java Transform [xmlfile] [xsltfile]");
System.exit(1);
}
File xmlFile = new File(args[0]);
File xsltFile = new File(args[1]);
Source xmlSource = new StreamSource(xmlFile);
Source xsltSource = new StreamSource(xsltFile);
TransformerFactory transFact =
TransformerFactory.newInstance();
Transformer trans = transFact.newTransformer(xsltSource); // 改成newTransformer(); 即不使用XSLT文件则可以正常输出
trans.transform(xmlSource, new StreamResult(System.out));
}
}
============ 运行: java Transform schedule.xml schedule.xslt
报错:
#
# An unexpected error has been detected by HotSpot Virtual Machine:
#
# EXCEPTION_FLT_STACK_CHECK (0xc0000092) at pc=0x00ded115, pid=2028, tid=2240
#
# Java VM: Java HotSpot(TM) Client VM (1.4.2_09-b05 mixed mode)
# Problematic frame:
# v ~RuntimeStub::init_check_patching Runtime1 stub
#
# An error report file with more information is saved as hs_err_pid2028.log
#
# If you would like to submit a bug report, please visit:
# http://java.sun.com/webapps/bugreport/crash.jsp
#
XML与XSLT文件应该都没有问题. 这样的错误是什么意思? 请帮我试试你们运行的结果是否会出错, 谢谢!
问题点数:20、回复次数:1Top
1 楼SwordMan2001(天笑2001)回复于 2005-11-04 17:23:50 得分 20
程序没有错,运行正常.请检查环境配置.
这是运行结果:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Schedule</title></head><body><h2 align="center">Eric Burke's Schedule</h2><hr xmlns="" /><h3 xmlns="">Appointment</h3><p xmlns="">03/15/2001
from
09:30
until
10:30</p><table xmlns=""><tr><td>Subject:</td><td>Interview potential new hire</td></tr><tr><td>Location:</td><td>Rm 103</td></tr><tr><td>Note:</td><td>Ask Bob for an updated resume.</td></tr></table><hr xmlns="" /><h3 xmlns="">Appointment</h3><p xmlns="">03/15/2001
from
15:30
until
16:30</p><table xmlns=""><tr><td>Subject:</td><td>Dr. Appointment</td></tr><tr><td>Location:</td><td>1532 Main Street</td></tr><tr><td>Note:</td><td /></tr></table><hr xmlns="" /><h3 xmlns="">Appointment</h3><p xmlns="">03/16/2001
from
11:30
until
12:30</p><table xmlns=""><tr><td>Subject:</td><td>Lunch w/Boss</td></tr><tr><td>Location:</td><td>Pizza Place on First Capitol Drive</td></tr><tr><td>Note:</td><td /></tr></table></body></html>
Top




