jdom解析xml时报错:Invalid byte 2 of 2-byte UTF-8 sequence

解析xml时报错:

 

ERROR: com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: Invalid byte 2 of 2-byte UTF-8 sequence.com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: Invalid byte 2 of 2-byte UTF-8 sequence.

 at com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.invalidByte(Unknown Source)
 at com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.read(Unknown Source)
 at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.load(Unknown Source)
 at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.scanData(Unknown Source)
 at com.sun.org.apache.xerces.internal.impl.XMLScanner.scanComment(Unknown Source)
 at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanComment(Unknown Source)
 at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
 at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
 at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)
 at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
 at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
 at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
 at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
 at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
 at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
 at org.jdom.input.SAXBuilder.build(SAXBuilder.java:453)
 at org.jdom.input.SAXBuilder.build(SAXBuilder.java:770)
 at cfgData.CfgData.getCfgInfo(CfgData.java:57)
 at cfgData.CfgData.<init>(CfgData.java:24)
 at cfgData.CfgData.getCfgData(CfgData.java:36)
 at cfgData.CfgData.main(CfgData.java:99)
Exception in thread "main" java.lang.NumberFormatException: null
 at java.lang.Integer.parseInt(Unknown Source)
 at java.lang.Integer.parseInt(Unknown Source)
 at cfgData.CfgData.<init>(CfgData.java:27)
 at cfgData.CfgData.getCfgData(CfgData.java:36)
 at cfgData.CfgData.main(CfgData.java:99)

 

原因是:读取的xml在用UE保存时,格式用了“默认”,而不是UTF-8

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值