你好老师。我按照你得代码来进行操作,却出现这种异常,为啥?

来源:2-1 如何进行 XML 文件解析前的准备工作

慕虎6315214

2018-07-27 09:38

java.io.UnsupportedEncodingException: UIF-8

at sun.nio.cs.StreamDecoder.forInputStreamReader(Unknown Source)

at java.io.InputStreamReader.<init>(Unknown Source)

at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.createReader(Unknown Source)

at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.setEncoding(Unknown Source)

at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanXMLDeclOrTextDecl(Unknown Source)

at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$XMLDeclDriver.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 javadashen.DOMTest.main(DOMTest.java:26)




写回答 关注

2回答

  • 九天冰尘
    2018-07-27 11:10:25
    已采纳

    你xml文件保存是的编码方式和你编写程序用软件编码方式不一样。

    慕虎6315...

    非常感谢!

    2018-07-27 21:55:16

    共 1 条回复 >

  • 石好看本好看
    2018-09-29 09:57:37

    怎么改的这种错误

Java眼中的XML---文件读取

通过Java认识并且创造XML文件,如何应用 Java“解析 XML

83202 学习 · 431 问题

查看课程

相似问题