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

dom4j中reader.read(String[] file)异常
Exception in thread "main" org.dom4j.DocumentException: Error on line 9 of document file:///E:/java测试/Tetris/config/cfg.xml : 与元素类型 "width" 相关联的属性 "{1}" 应有左引号。 Nested exception: 与元素类型 "width" 相关联的属性 "{1}" 应有左引号。
at org.dom4j.io.SAXReader.read(SAXReader.java:482)
at org.dom4j.io.SAXReader.read(SAXReader.java:264)
at config.ConfigReader.readConfig(ConfigReader.java:12)
at config.ConfigReader.main(ConfigReader.java:19)
Nested exception: 
org.xml.sax.SAXParseException; systemId: file:///E:/java测试/Tetris/config/cfg.xml; lineNumber: 9; columnNumber: 53; 与元素类型 "width" 相关联的属性 "{1}" 应有左引号。
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLScanner.scanAttributeValue(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanAttribute(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(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.dom4j.io.SAXReader.read(SAXReader.java:465)
at org.dom4j.io.SAXReader.read(SAXReader.java:264)
at config.ConfigReader.readConfig(ConfigReader.java:12)
at config.ConfigReader.main(ConfigReader.java:19)
已经查了中文路径和xml配置的问题,试了下都无法解决
java源码
package config;

import java.io.File;