commons-digester 使用規則檔案時解析錯誤問題

mcindo發表於2003-12-03
我使用的commons-digester解析xml檔案,配置檔案時一個,規則檔案(也就是匹配規則)是另一個,使用

URL rulesURL = getClass().getClassLoader().getResource("com/xx/web/util/xml/project-rule.xml");
Digester digester = DigesterLoader.createDigester(rulesURL);
<p class="indent">


載入規則檔案時提示

11:16:31,637 ERROR [STDERR] java.net.MalformedURLException
11:16:31,637 ERROR [STDERR]     at java.net.URL.<init>(URL.java:571)
11:16:31,637 ERROR [STDERR]     at java.net.URL.<init>(URL.java:434)
11:16:31,637 ERROR [STDERR]     at java.net.URL.<init>(URL.java:383)
11:16:31,647 ERROR [STDERR]     at org.apache.xerces.impl.XMLEntityManager.start
Entity(XMLEntityManager.java:740)
11:16:31,647 ERROR [STDERR]     at org.apache.xerces.impl.XMLEntityManager.start
DocumentEntity(XMLEntityManager.java:685)
11:16:31,647 ERROR [STDERR]     at org.apache.xerces.impl.XMLDocumentScannerImpl
.setInputSource(XMLDocumentScannerImpl.java:252)
11:16:31,647 ERROR [STDERR]     at org.apache.xerces.parsers.StandardParserConfi
guration.parse(StandardParserConfiguration.java:503)
<p class="indent">


URL不對? 我將他讀dtd的url,和我自己的url都打出來了,一樣的.為什麼我載入時會報這個錯呢?

下面是打出來的路徑:

11:16:31,297 INFO  [STDOUT] ruleURL:jar:file:/D:/jboss3.2.1-tomcat4.1.24/server/
default/tmp/deploy/server/default/deploy/yjjy.ear/52.yjjy.ear-contents/so.jar!/c
om/xx/web/util/xml/project-rule.xml
11:16:31,507 INFO  [STDOUT] dtdUrl:jar:file:/D:/jboss3.2.1-tomcat4.1.24/server/default/tmp/deploy/server/default/deploy/jbossweb-tomcat.sar/commons-digester.jar/22.commons-digester.jar!/org/apache/commons/digester/xmlrules/digester-rules.dtd
<p class="indent">


shui 什麼原因???

相關文章