请问:jdom生成xml中(UTF-8),部分中文字符出现乱码,是怎么回事呢? 先处理一下 <%request.setCharacterEncoding("GB2312")%> 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 我已经找到了,是我又通过程序访问xml文件replace了一个字符造成的 但我想生成:<?xml version="1.0" encoding="UTF-8"?><report xmlns="http://fitech-report.com/smis" xmlns:xsi="http://www.w3.org/2001/XMLSchema" reporttype="POINT" reportlayer="MAIN"> <common> <sign> <fitechFiller>admin</fitechFiller> <fitechChecker>admin</fitechChecker> <fitechPrincipal>admin</fitechPrincipal> </sign> </common></report>添加Namespace ns_xml = Namespace.getNamespace("", reportObj.getXmlns_Attr()); Namespace ns_xsi = Namespace.getNamespace("xsi", reportObj.getXmlnsxsi_Attr()); reportElement.setNamespace(ns_xml); reportElement.addNamespaceDeclaration(ns_xsi);后就生成了:<?xml version="1.0" encoding="UTF-8"?><report xmlns="http://fitech-report.com/smis" xmlns:xsi="http://www.w3.org/2001/XMLSchema" reporttype="POINT" reportlayer="MAIN"> <common xmlns=""> <sign> <fitechFiller>admin</fitechFiller> <fitechChecker>admin</fitechChecker> <fitechPrincipal>admin</fitechPrincipal> </sign> </common></report>这样在common节点中添加了xmlns=""是我不想要的,改怎么处理呢???谢谢 请教个问题。怎么让sql默认查询条件为全部啊? JAVA提取邮箱联系人问题 jpa 是不是不能应用到 j2se上面来 proxool的问题!! lucene2.0与lucene1.4兼容问题 当客户端死机后,如何通过管理员remove这个客户端占用的stateful session bean? 一个很简单的问题,望各位高手指教。 jbuilder7+weblogic7,编译jsp时候出错了!怎么办? 用mina实现websocket服务端,是否需要处理粘包和断包问题 dubbo问题 在尚学堂学了三个月,让我脱胎换骨!!软件工程师 JBoss配置Mysql数据库的问题,急等大虾解决
<?xml version="1.0" encoding="UTF-8"?>
<report xmlns="http://fitech-report.com/smis" xmlns:xsi="http://www.w3.org/2001/XMLSchema" reporttype="POINT" reportlayer="MAIN">
<common>
<sign>
<fitechFiller>admin</fitechFiller>
<fitechChecker>admin</fitechChecker>
<fitechPrincipal>admin</fitechPrincipal>
</sign>
</common>
</report>
添加Namespace ns_xml = Namespace.getNamespace("", reportObj.getXmlns_Attr());
Namespace ns_xsi = Namespace.getNamespace("xsi", reportObj.getXmlnsxsi_Attr());
reportElement.setNamespace(ns_xml);
reportElement.addNamespaceDeclaration(ns_xsi);
后就生成了:
<?xml version="1.0" encoding="UTF-8"?>
<report xmlns="http://fitech-report.com/smis" xmlns:xsi="http://www.w3.org/2001/XMLSchema" reporttype="POINT" reportlayer="MAIN">
<common xmlns="">
<sign>
<fitechFiller>admin</fitechFiller>
<fitechChecker>admin</fitechChecker>
<fitechPrincipal>admin</fitechPrincipal>
</sign>
</common>
</report>这样在common节点中添加了xmlns=""是我不想要的,改怎么处理呢???谢谢