未知协议:c(JDOM和SAXBuilder) [英] unknown protocol: c (JDOM a SAXBuilder)
本文介绍了未知协议:c(JDOM和SAXBuilder)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在将JDOM与SAXBuilder一起使用来解析XML文件,并且文件有问题,引发此错误:
I'm using JDOM with SAXBuilder to parse XML files, and I have a problem with a file which is throwing this error :
java.net.MalformedURLException: unknown protocol: c
at java.net.URL.<init>(URL.java:574)
at java.net.URL.<init>(URL.java:464)
at java.net.URL.<init>(URL.java:413)
at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
at org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at org.jdom.input.SAXBuilder.build(SAXBuilder.java:518)
at org.jdom.input.SAXBuilder.build(SAXBuilder.java:986)
at com.foo.moo.MyClass.getValues(MyClass.java:321)
这行是:
Document document = null;
document = sxb.build(files.elementAt(i)); // This one
在互联网上进行了一些研究之后,我认为该错误与Java 1.6有关.
After doing some research on the internet, I think the error is related to Java 1.6.
您怎么看?
推荐答案
我的第一个猜测是您正在加载本地文件,例如:"c:/mylocalfile.xml"
My first guess is that you are loading a local file, like: "c:/mylocalfile.xml"
但是此URL不包含协议,例如http://
,ftp://
或file://
But this URL does not contain the protocol, like http://
, ftp://
or file://
尝试file://c:/mylocalfile.xml
Try file://c:/mylocalfile.xml
这篇关于未知协议:c(JDOM和SAXBuilder)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文