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"是表示一个
外部的内容。
本文介绍了XML中使用未解析实体的方法,包括NDATA关键字定义及EntityResolver API的应用,用于处理外部资源引用。
1161

被折叠的 条评论
为什么被折叠?



