總是出現(xiàn)這個(gè)異常怎么回事
出這異常 怎么回事?
com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: 2 字節(jié)的 UTF-8 序列的字節(jié) 2 無效。
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.peekChar(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.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.DOMParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(Unknown Source)
at javax.xml.parsers.DocumentBuilder.parse(Unknown Source)
at com.paike.dmtest.test.DomTest.main(DomTest.java:25)
2022-03-24
foreach循環(huán)自動(dòng)遍歷數(shù)組和集合的每個(gè)元素在函數(shù)后面的那個(gè)document.getElementById("fruit").value=res;前面加一個(gè)return就行了
2018-06-06
代碼實(shí)現(xiàn)的話 用java的io流對你那個(gè)xml文件重新讀寫一下 把編碼格式改了
2017-08-08
用記事本打開.xml文件,另存為時(shí)選擇編碼方式為UTF-8覆蓋原來的.xml文件,再進(jìn)入eclipse->File->Refresh。
2017-07-31
這個(gè)問題我解決了,右鍵選擇Open with--Test Edit打開books.xml,是亂碼,你把亂碼刪掉,自己輸入,保存,運(yùn)行時(shí)就不會(huì)報(bào)以上異常了,求采納(原因:你在創(chuàng)建文本文件時(shí),默認(rèn)編碼是ANSI,不是utf-8,所以傳進(jìn)myeclips會(huì)出現(xiàn)亂碼)
2017-07-12
你在eclipse里面打開看看books.xml內(nèi)容是不是亂碼?
如果是亂碼,你用其他工具打開books.xml,將沒有亂碼的內(nèi)容拷貝到eclipse中的books.xml;
2017-07-07
你的xml文件編碼不是UTF-8吧,修改成UTF-8再運(yùn)行一下就應(yīng)該不會(huì)再報(bào)錯(cuò)了