parser.parse是什么意思:请看代码(在线等)

fggph 2003-08-07 02:49:02
public class XmlParser extends DefaultHandler {

private static final String ID = "ID";
。。。。

File file = new File(propspath, "bblk.xml");
parser.parse(file, this);
}
DefaultHandler 这个类我还是不明白,特别是parser.parse(file, this)这句做什么呀,有谁帮我解释一下。我的一本书在于你的一句话。谢谢:


...全文
1026 5 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
fggph 2003-08-16
  • 打赏
  • 举报
回复
bobfallen,解析包括读XML里的数据吗,
阎罗 2003-08-08
  • 打赏
  • 举报
回复
parser.parse(file, this)用来解析xml文档就是括号中的file,
DefaultHandler类是SAX2.0中用于事件处理的基类,包括4个事件处理接口EntityResolver, ContentHandler, ErrorHandlerHandler和DTDHandler.
wxj276 2003-08-08
  • 打赏
  • 举报
回复
parse应该是JAVA本身代的类包吧
sgdb 2003-08-08
  • 打赏
  • 举报
回复
public void parse(File f,
DefaultHandler dh)
throws SAXException,
IOExceptionParse the content of the file specified as XML using the specified DefaultHandler.

Parameters:
f - The file containing the XML to parse
dh - The SAX DefaultHandler to use.
Throws:
IOException - If any IO errors occur.
IllegalArgumentException - If the File object is null.
SAXException - If the underlying parser throws a SAXException while parsing.
fft123 2003-08-08
  • 打赏
  • 举报
回复
找一下你的类里parser在什么地方定义的
把DefaultHandler这个类反编译,看看parse的参数

81,122

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧