日期:2014-05-20  浏览次数:20706 次

JDOM帮助
其中如果ne= '英文字符串 '那么它最后生成的是
<?xml   version= '1.0 '   encoding= 'GBK '?>
    <new   package= 'vne '   class= 'TerminalService '   name= '__remote_object '   >
          <params   ne= 'GW1 '   port= 'port1 '   client_type= 'terminal '/>
    </new>
如果ne= '中文 '那么它最后生成的是,并且报错,说需要有 </new> 结束标记
<?xml   version= '1.0 '   encoding= 'GBK '?>
    <new   package= 'vne '   class= 'TerminalService '   name= '__remote_object '   >
          <params   ne= '长途局 '   port= 'port1 '   client_type= 'terminal '/>
    </n

其中ne的取值是从数据库中取的,然后通过jdom生成xml

------解决方案--------------------
不支持嘛
------解决方案--------------------
</n --> </new>
------解决方案--------------------
中文是支持的,连中文的tag都支持,我怀疑你生成的xml文件编码不对
不是写了encoding=GBK就可以了,应该
format = Format.getCompactFormat();
format.setEncoding( "GB2312 ");//ISO-8859-1 ");//GBK
format.setIndent( " ");
XMLOutputter XMLOut = new XMLOutputter(format);