org.openide.xml
Class EntityCatalog

java.lang.Object
  extended by org.openide.xml.EntityCatalog
All Implemented Interfaces:
org.xml.sax.EntityResolver

public abstract class EntityCatalog
extends java.lang.Object
implements org.xml.sax.EntityResolver

Entity resolver resolving all entities registered by modules. Use getDefault() to get the master instance in system. Any parser working with unknown XML documents should use it to avoid unnecessary Internet connections.

You can register your own instances via lookup to add to the resolver pool, for example using an XML file in the format defined by PUBLIC_ID, but for reasons of performance and predictability during startup it is best to provide the entity (e.g. some DTD you define) as the contents of a file in the system filesystem, in the /xml/entities/ folder, where the file path beneath this folder is based on the public ID as follows:

  1. US-ASCII alphanumeric characters and '_' are left as is.
  2. Spaces and various punctuation are converted to '_' (one per character).
  3. Initial '-//' is dropped.
  4. Final '//EN' is dropped.
  5. Exactly two forward slashes in a row are converted to one.
Thus for example the public ID -//NetBeans//Entity Mapping Registration 1.0//EN would be looked for in the file /xml/entities/NetBeans/Entity_Mapping_Registration_1_0. Naturally this only works if you are defining a fixed number of entities.

It is recommended that the entity file in /xml/entities/ also be given a file attribute named hint.originalPublicID with a string value giving the public ID.

Since:
release 3.2
Author:
Petr Kuzel

Field Summary
static java.lang.String PUBLIC_ID
          DOCTYPE public ID defining grammar used for entity registrations.
 
Constructor Summary
EntityCatalog()
           
 
Method Summary
static EntityCatalog getDefault()
          Get a master entity catalog which can delegate to any others that have been registered via lookup.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.xml.sax.EntityResolver
resolveEntity
 

Field Detail

PUBLIC_ID

public static final java.lang.String PUBLIC_ID
DOCTYPE public ID defining grammar used for entity registrations.

See Also:
Constant Field Values
Constructor Detail

EntityCatalog

public EntityCatalog()
Method Detail

getDefault

public static EntityCatalog getDefault()
Get a master entity catalog which can delegate to any others that have been registered via lookup.