Top Description Fields Constructors Methods
org.hibernate.internal.util.xml

public Class DTDEntityResolver

extends Object
implements EntityResolver, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, org.xml.sax.EntityResolver
Known Direct Subclasses
org.hibernate.cfg.EJB3DTDEntityResolver
Annotations
@Deprecated
Imports
java.io.InputStream, .Serializable, org.hibernate.internal.CoreMessageLogger, org.hibernate.internal.util.ConfigHelper, org.jboss.logging.Logger, org.xml.sax.EntityResolver, .InputSource

Deprecated

Hibernate now uses StAX for XML processing and the role of this class is served now by org.hibernate.boot.jaxb.internal.stax.LocalXmlResourceResolver

An EntityResolver implementation which attempts to resolve various systemId URLs to local classpath look ups
  1. Any systemId URL beginning with http://www.hibernate.org/dtd/ is searched for as a classpath resource in the classloader which loaded the Hibernate classes.
  2. Any systemId URL using classpath as the scheme (i.e. starting with classpath:// is searched for as a classpath resource using first the current thread context classloader and then the classloader which loaded the Hibernate classes.

Any entity references which cannot be resolved in relation to the above rules result in returning null, which should force the SAX reader to handle the entity reference in its default manner.

Authors
Markus Meissner, Gavin King, Steve Ebersole, Hardy Ferentschik

Field Summary

Modifier and TypeField and Description
private static final String
private static final CoreMessageLogger
private static final String
private static final String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public InputSource
resolveEntity(String
The public identifier of the external entity being referenced, or null if none was supplied.
publicId
,
String
The system identifier of the external entity being referenced.
systemId
)

Implements org.xml.sax.EntityResolver.resolveEntity.

Allow the application to resolve external entities.
protected InputStream
protected InputStream
private InputSource
resolveOnClassPath(String publicId, String systemId, String namespace)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

HIBERNATE_NAMESPACEback to summary
private static final String HIBERNATE_NAMESPACE
LOGback to summary
private static final CoreMessageLogger LOG
OLD_HIBERNATE_NAMESPACEback to summary
private static final String OLD_HIBERNATE_NAMESPACE
USER_NAMESPACEback to summary
private static final String USER_NAMESPACE

Constructor Detail

DTDEntityResolverback to summary
public DTDEntityResolver()

Method Detail

resolveEntityback to summary
public InputSource resolveEntity(String publicId, String systemId)

Implements org.xml.sax.EntityResolver.resolveEntity.

Doc from org.xml.sax.EntityResolver.resolveEntity.

Allow the application to resolve external entities.

The parser will call this method before opening any external entity except the top-level document entity. Such entities include the external DTD subset and external parameter entities referenced within the DTD (in either case, only if the parser reads external parameter entities), and external general entities referenced within the document element (if the parser reads external general entities). The application may request that the parser locate the entity itself, that it use an alternative URI, or that it use data provided by the application (as a character or byte input stream).

Application writers can use this method to redirect external system identifiers to secure and/or local URIs, to look up public identifiers in a catalogue, or to read an entity from a database or other input source (including, for example, a dialog box). Neither XML nor SAX specifies a preferred policy for using public or system IDs to resolve resources. However, SAX specifies how to interpret any InputSource returned by this method, and that if none is returned, then the system ID will be dereferenced as a URL.

If the system identifier is a URL, the SAX parser must resolve it fully before reporting it to the application.

Parameters
publicId:String

The public identifier of the external entity being referenced, or null if none was supplied.

systemId:String

The system identifier of the external entity being referenced.

Returns:InputSource

An InputSource object describing the new input source, or null to request that the parser open a regular URI connection to the system identifier.

resolveInHibernateNamespaceback to summary
protected InputStream resolveInHibernateNamespace(String path)
resolveInLocalNamespaceback to summary
protected InputStream resolveInLocalNamespace(String path)
resolveOnClassPathback to summary
private InputSource resolveOnClassPath(String publicId, String systemId, String namespace)