V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
chengchuan1009
V2EX  ›  问与答

我已经被这个八阿哥恶搞死了,也不说是哪一个文件!网上查了下,说是编码格式的问题,改为 ascii 就好了。 所以我就把一对的 xml 文件用记事本另存为 ascii(sublime 好像没有这个这个选项?),还是不行!

  •  
  •   chengchuan1009 · 2015-08-24 21:38:48 +08:00 · 2865 次点击
    这是一个创建于 3412 天前的主题,其中的信息可能已经有所发展或是发生改变。

    我又全部换成 UTF-8 (没有 BOM 的哦),还是不行啊。
    一下午,半晚上,我都没搞定,到死改哪一个文件啊,求帮助!!!

    Error:Internal error: (org.jdom.input.JDOMParseException ) Error on line 1: 前言中不允许有内容。
    org.jdom.input.JDOMParseException: Error on line 1: 前言中不允许有内容。
    at org.jdom.input.SAXBuilder.build (SAXBuilder.java:533 )
    at org.jdom.input.SAXBuilder.build (SAXBuilder.java:946 )
    at com.intellij.openapi.util.JDOMUtil.loadDocument (JDOMUtil.java:364 )
    at com.intellij.openapi.util.JDOMUtil.loadDocument (JDOMUtil.java:342 )
    at org.jetbrains.jps.model.serialization.JpsLoaderBase.tryLoadRootElement (JpsLoaderBase.java:99 )
    at org.jetbrains.jps.model.serialization.JpsLoaderBase.loadRootElement (JpsLoaderBase.java:72 )
    at org.jetbrains.jps.model.serialization.JpsLoaderBase.loadRootElement (JpsLoaderBase.java:43 )
    at org.jetbrains.jps.model.serialization.JpsLoaderBase.loadComponents (JpsLoaderBase.java:55 )
    at org.jetbrains.jps.model.serialization.JpsProjectLoader.loadFromDirectory (JpsProjectLoader.java:119 )
    at org.jetbrains.jps.model.serialization.JpsProjectLoader.loadProject (JpsProjectLoader.java:98 )
    at org.jetbrains.jps.model.serialization.impl.JpsSerializationManagerImpl.loadModel (JpsSerializationManagerImpl.java:41 )
    at org.jetbrains.jps.cmdline.JpsModelLoaderImpl.loadModel (JpsModelLoaderImpl.java:45 )
    at org.jetbrains.jps.cmdline.BuildRunner.load (BuildRunner.java:78 )
    at org.jetbrains.jps.cmdline.BuildSession.runBuild (BuildSession.java:261 )
    at org.jetbrains.jps.cmdline.BuildSession.run (BuildSession.java:124 )
    at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler$1.run (BuildMain.java:238 )
    at org.jetbrains.jps.service.impl.SharedThreadPoolImpl$1.run (SharedThreadPoolImpl.java:41 )
    at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:471 )
    at java.util.concurrent.FutureTask.run (FutureTask.java:262 )
    at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1145 )
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:615 )
    at java.lang.Thread.run (Thread.java:744 )
    Caused by: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; 前言中不允许有内容。
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException (ErrorHandlerWrapper.java:198 )
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError (ErrorHandlerWrapper.java:177 )
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError (XMLErrorReporter.java:441 )
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError (XMLErrorReporter.java:368 )
    at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError (XMLScanner.java:1436 )
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next (XMLDocumentScannerImpl.java:999 )
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next (XMLDocumentScannerImpl.java:606 )
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next (XMLNSDocumentScannerImpl.java:117 )
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument (XMLDocumentFragmentScannerImpl.java:510 )
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse (XML11Configuration.java:848 )
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse (XML11Configuration.java:777 )
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse (XMLParser.java:141 )
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse (AbstractSAXParser.java:1213 )
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse (SAXParserImpl.java:649 )
    at org.jdom.input.SAXBuilder.build (SAXBuilder.java:518 )
    ... 21 more
    Caused by: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; 前言中不允许有内容。
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException (ErrorHandlerWrapper.java:198 )
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError (ErrorHandlerWrapper.java:177 )
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError (XMLErrorReporter.java:441 )
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError (XMLErrorReporter.java:368 )
    at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError (XMLScanner.java:1436 )
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next (XMLDocumentScannerImpl.java:999 )
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next (XMLDocumentScannerImpl.java:606 )
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next (XMLNSDocumentScannerImpl.java:117 )
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument (XMLDocumentFragmentScannerImpl.java:510 )
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse (XML11Configuration.java:848 )
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse (XML11Configuration.java:777 )
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse (XMLParser.java:141 )
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse (AbstractSAXParser.java:1213 )
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse (SAXParserImpl.java:649 )
    at org.jdom.input.SAXBuilder.build (SAXBuilder.java:518 )
    at org.jdom.input.SAXBuilder.build (SAXBuilder.java:946 )
    at com.intellij.openapi.util.JDOMUtil.loadDocument (JDOMUtil.java:364 )
    at com.intellij.openapi.util.JDOMUtil.loadDocument (JDOMUtil.java:342 )
    at org.jetbrains.jps.model.serialization.JpsLoaderBase.tryLoadRootElement (JpsLoaderBase.java:99 )
    at org.jetbrains.jps.model.serialization.JpsLoaderBase.loadRootElement (JpsLoaderBase.java:72 )
    at org.jetbrains.jps.model.serialization.JpsLoaderBase.loadRootElement (JpsLoaderBase.java:43 )
    at org.jetbrains.jps.model.serialization.JpsLoaderBase.loadComponents (JpsLoaderBase.java:55 )
    at org.jetbrains.jps.model.serialization.JpsProjectLoader.loadFromDirectory (JpsProjectLoader.java:119 )
    at org.jetbrains.jps.model.serialization.JpsProjectLoader.loadProject (JpsProjectLoader.java:98 )
    at org.jetbrains.jps.model.serialization.impl.JpsSerializationManagerImpl.loadModel (JpsSerializationManagerImpl.java:41 )
    at org.jetbrains.jps.cmdline.JpsModelLoaderImpl.loadModel (JpsModelLoaderImpl.java:45 )
    at org.jetbrains.jps.cmdline.BuildRunner.load (BuildRunner.java:78 )
    at org.jetbrains.jps.cmdline.BuildSession.runBuild (BuildSession.java:261 )
    at org.jetbrains.jps.cmdline.BuildSession.run (BuildSession.java:124 )
    at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler$1.run (BuildMain.java:238 )
    at org.jetbrains.jps.service.impl.SharedThreadPoolImpl$1.run (SharedThreadPoolImpl.java:41 )
    at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:471 )
    at java.util.concurrent.FutureTask.run (FutureTask.java:262 )
    at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1145 )
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:615 )
    at java.lang.Thread.run (Thread.java:744 )

    13 条回复    2015-08-28 23:38:58 +08:00
    churchmice
        1
    churchmice  
       2015-08-24 22:17:17 +08:00
    lz 你需要科普一下编码的基本常识,而不是搞得焦头烂额
    ASCII 编码只能最多编码 255 个字符,你如果有中文,是绝逼编码不下的
    chengchuan1009
        2
    chengchuan1009  
    OP
       2015-08-24 22:41:01 +08:00
    对哦这个不是 bug
    chengchuan1009
        3
    chengchuan1009  
    OP
       2015-08-24 22:43:10 +08:00
    @churchmice 对哦,只是确实比较欠缺
    em70
        4
    em70  
       2015-08-24 22:45:55 +08:00 via Android
    中文可以做 base64 ,就全部 ascii 了
    popok
        5
    popok  
       2015-08-25 08:19:13 +08:00
    确定是 ascii 不是 ansi?
    Cloudee
        6
    Cloudee  
       2015-08-25 13:53:48 +08:00
    是不是因为 XML 是带 BOM 的 utf-8 格式?你个另存为不带 BOM 的 utf-8 试试?
    chengchuan1009
        7
    chengchuan1009  
    OP
       2015-08-25 14:21:36 +08:00 via iPhone
    @Cloudee 我设置文件格式为 UTF8 可以么
    Cloudee
        8
    Cloudee  
       2015-08-25 14:26:52 +08:00
    sublime 的 Save with Encoding 里面,有 utf-8 和 utf-8 with BOM ,你试试选不带 with BOM 的 utf-8 另存一个试试
    Cloudee
        9
    Cloudee  
       2015-08-25 14:27:39 +08:00
    Oops ,发现 LZ 已经存成没 BOM 的了。。。那就不知道为什么了。。。不好意思 orz
    chengchuan1009
        10
    chengchuan1009  
    OP
       2015-08-27 23:28:25 +08:00
    @Cloudee 已解决,谢谢啦
    chengchuan1009
        11
    chengchuan1009  
    OP
       2015-08-27 23:28:52 +08:00
    @em70
    @popok
    已解决,谢谢啦
    Cloudee
        12
    Cloudee  
       2015-08-28 17:48:24 +08:00
    @chengchuan1009 哈哈,怎么解决的?
    chengchuan1009
        13
    chengchuan1009  
    OP
       2015-08-28 23:38:58 +08:00
    @Cloudee 不是项目里面的配置文件的问题,我发现 workspace.xml 里面没有内容,但是报第一排有错误,我就清空了它,后来打开不知道怎么回事又有东西了,然后...就好了
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   3651 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 04:22 · PVG 12:22 · LAX 20:22 · JFK 23:22
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.