Try OpenEdge Now
skip to main content
Working with XML
Reading XML Documents with the Simple API for XML (SAX) : SAX API reference : SAX callback reference : ResolveEntity
 
ResolveEntity
Invoked to let the application specify the location of an external entity (such as a DTD or XML Schema).
When the parser finds an external entity reference, it calls ResolveEntity, passing it the system identifier and public identifier (if any) contained in the XML. This gives the application a chance to override the location specified in the XML.

Syntax

PROCEDURE ResolveEntity:
DEFINE INPUT PARAMETER publicID AS CHARACTER.
DEFINE INPUT PARAMETER systemID AS CHARACTER.
DEFINE OUTPUT PARAMETER filePath AS CHARACTER.
DEFINE OUTPUT PARAMETER memPointer AS { MEMPTR | LONGCHAR}.
publicID
Optional. A character string indicating the public identifier of the entity. If none is supplied, the string is of length zero.
systemID
A character string indicating the system identifier of the entity. The character string will not be of length zero, as this parameter is required. systemID will be one of the following:
*Absolute file path
*Relative file path
*Absolute URL
filePath
Optional. A character string indicating the actual location of the entity being resolved. This tells the parser where to actually get the entity, in preference to the location specified by the system identifier.
filePath will be one of the following:
*Absolute file path
*Relative file path
*HTTP URI
If you do not supply filePath, set it to the Unknown value (?).
memPointer
Optional. A MEMPTR or LONGCHAR containing the entity being resolved. Use memPointer to return XML representing an entity that is not stored as a stand-alone file.
If you do not supply memPointer, set it to the Unknown value (?).
Caution: Supplying both filePath and memPointer is an error.
If the application does not implement this callback, or if the callback sets both filePath and memPointer to the Unknown value (?), the entity is resolved according to the following rules (which are also the rules that the ABL DOM interface uses):
1. If the location given in the XML source is a relative path and the SAX-reader:SCHEMA-PATH attribute has been set, try appending the relative path to each entry in SCHEMA-PATH and retrieving the file there.
2. If the location is a relative file path and the SAX-reader:SCHEMA-PATH attribute has the Unknown value (?), try retrieving the file relative to the working directory.
3. If the location given in the XML source is an absolute path to a local file or if it is an HTTP URI, try retrieving the file at the specified location.
4. If the file cannot be found, the parser calls the FatalError callback (if there is one) and stops processing the XML.