|
异常:java.net.MalformedURLException: no protocol: test.xml
win2000,tomcat
请帮忙!
|
请帮忙!
SAXBuilder sb = new SAXBuilder(); |
XMLFileName.java
|
|
另外,发现用 Weblogic 8 时出错:
org.xml.sax.SAXParseException: Invalid encoding name "GBK".
at weblogic.apache.xerces.parsers.DOMParser.parse(DOMParser.java:271)
必须用下面的写法:
Document doc=db.parse(new FileInputStream("test.xml"));
java.io.Reader reader = new FileReader("test.xml");
org.xml.sax.InputSource source = new InputSource(reader);
Document doc=db.parse(source);
真是麻烦啊!Weblogic 7 没有这个问题。
必须用下面的写法:
java.io.Reader reader = new FileReader("test.xml");
org.xml.sax.InputSource source = new InputSource(reader);
Document doc=db.parse(source);
你是不是进行DTD的验证了?
如果是的话,会连接到你的DTD说明的地址,估计会出现这个错误
这种情况下的解决办法就是不验证DTD,把一个方法的参数改为false就行了。
this.getClass() 可被Thread.getCurrentThread().getClassLoader(好象是这个)代替