Arbortext Command Language > Callbacks > doc_add_callback > entity_path Callback Type
  
entity_path Callback Type
Function prototype:
function funcname (doc, entname, pubid, sysid, type, notation)
entity_path is called to resolve an external entity and allows an application to override the default way of looking up an external entity path name. It must return the path name of a file to be opened by the standard I/O library functions open or fopen or the null string, if it is not able to associate a system path name with the entity. If a null string, the default processing is done.
If the path name returned is a file (that is, it does not contain any directory components), Arbortext Editor searches the document directory for the name if appropriate, and if a graphic entity, searches the path list specified by the environment variable APTCATPATH to locate the file.
Arguments
doc is the identifier of the document associated with the entity path.
entname is the name of the entity to be resolved.
pubid is the public identifier or a null string if no PUBLIC ID was specified on the entity declaration.
sysid is the system identifier or NULL if no SYSTEM ID was specified on the entity declaration.
type is the declared type of the entity and is one of the strings "SUBDOC", "NDATA", "CDATA", "SDATA" or the null string if no type was declared (that is, an SGML text entity).
notation is the specified data notation if entname is a graphic entity, or the null string otherwise.
Example
Here is an example function that implements the default entity path name processing:
function entpathhook(doc, entity, public, system, type)
{
# if a PUBLIC id given, lookup that first and return
# associated path if found
if (public)
{
local path = public_id_path(public)
if (path) { return path;}
}
# otherwise, return SYSTEM if given, else ENTITY name
return system ? system : entity;
}
The body of this example function could be replaced by a call to the built-in function entity_path.
Related Topics
entity_path function