DTDHandler And EntityResolver

The DTDHandler API

In Choosing Your Parser Implementation you saw a method for referencing a file that contains binary data, such as an image file, using MIME data types. That is the simplest, most extensible mechanism. For compatibility with older SGML-style data, though, it is also possible to define an unparsed entity.

The NDATA keyword defines an unparsed entity:

  NDATA gif> 

The NDATA keyword says that the data in this entity is not parsable XML data but instead is data that uses some other notation. In this case, the notation is named gif. The DTD must then include a declaration for that notation, which would look something like this:

  NOTATION gif SYSTEM "..URL.."> 
notationDecl(String name, String publicId, String systemId)  
unparsedEntityDecl(String name, String publicId, 
  String systemId, String notationName)  
 
 

The EntityResolver API

The EntityResolver API lets you convert a public ID (URN) into a system ID (URL). Your application may need to do that, for example, to convert something like href="urn:/someName" into "http://someURL". The EntityResolver interface defines a single method: resolveEntity(String publicId, String systemId)
 
看了一点文档,感觉这个接口主要是用来处理这样的标签的,可以是dtd文件中也可以是xml文件中,"xx"是表示一个
外部的内容。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值