【发布时间】:2015-09-07 22:15:04
【问题描述】:
在为DTD 加载语法时,出现以下错误:
“未知协议 c”。
谁能帮忙解决这个错误?
XMLInputSource is = new XMLInputSource(null, dtdPath, null);
Hashtable temp = new Hashtable();
SymbolTable st = new SymbolTable();
DTDHandler handler = new DTDHandler();
XMLDTDLoader loader = new XMLDTDLoader(st);
loader.setDTDHandler(handler);
[![enter image description here][1]][1]
try {
Grammar grammar = loader.loadGrammar(is);
【问题讨论】:
-
您能否发布您的错误跟踪,以便我了解您在尝试什么?
-
XML 和 DTD 也会有所帮助。
-
我正在尝试从 java 文件中的 dtd 中检索元素..但我无法加载它
-
请张贴所有错误跟踪!我认为是 java.net.MalformedURLException: unknown protocol: c 对以 c 开头的路径来说是一个不好的转义。 XMLInputSource 中的 Mabey is = new XMLInputSource(null, dtdPath, null); dtdPath 应该使用 // 而不是 /