试试
DOMSource doms = new DOMSource( document );
File file = new File( name );
StreamResult result = new StreamResult( file );
TransformerFactory tf = TransformerFactory.newInstance();
Transformer transformer = tf.newTransformer();
Properties properties = transformer.getOutputProperties();
properties.setProperty( OutputKeys.ENCODING, "GB2312" );
properties.setProperty( OutputKeys.METHOD, "xml" );
properties.setProperty( OutputKeys.INDENT, "yes" );
transformer.setOutputProperties( properties );
transformer.transform( doms, result );
DOMSource doms = new DOMSource( document );
File file = new File( name );
StreamResult result = new StreamResult( file );
TransformerFactory tf = TransformerFactory.newInstance();
Transformer transformer = tf.newTransformer();
Properties properties = transformer.getOutputProperties();
properties.setProperty( OutputKeys.ENCODING, "GB2312" );
properties.setProperty( OutputKeys.METHOD, "xml" );
properties.setProperty( OutputKeys.INDENT, "yes" );
transformer.setOutputProperties( properties );
transformer.transform( doms, result );
解决方案 »
- 请各位进来看一下tomcat启动时的错误,完全看不懂。
- 毕设
- 使用HibernateTemplate的save()方法报错:ObjectRetrievalFailureException
- 关于JSP提取数据库时间问题。高手帮忙!
- 局域网内无法访问Tomcat
- 关于struts2 表单控件,事件的使用知道的朋友,进来看一下
- 请问EJB中7个事务属性(PROPAGATION_REQUIRED等)以及5个隔离属性的意思是什么?
- JSP与Tomcat5.0的配置问题,请帮帮忙!!
- 如何把ResultSet这个查询出来的table 结果转换成一个 与之对应的form
- 如何对对象进行查询?
- EJB部署好了!! 但客户端怎么运行
- 在jbuild6中,编绎import javax.ejb.*时出错,该如何解决?
Thank you, what's purpose of setting the properties?
Thank you, what's purpose of setting the properties?
Thank you, what's purpose of setting the properties?
主要是为了指定输出为XML,而且输出文件的编码为GB2312,还有输出格式
http://www.csdn.net/Expert/TopicView1.asp?id=722635
不过parser我建议你还是由Crimson转到Xerces,Crimson太慢
不过parser我建议你还是由Crimson转到Xerces,Crimson太慢
不过也没关系,代码都一样
你的错误看不出所以然来,一般说来应该是Classpath的问题,几个互相冲突的Xml相关jar文件,先调用了旧版本的。仔细检查你的ClassPath和JAVA_HOME/Lib/ext,注意先后顺序。
as i am running the application under another environment, it included some xml parsers in the library file. Looing into the classpath file won't help. If, I replace the old crimson with xerces, do you expect any problem?