Resolver for system-specific and external subset entities.

The resolve_ functions basically return an argument reference name as file name relative to a base name (the document location), unless configured otherwise.

Note that, despite the name, this has a quite different role from that of a SAX EntityResolver (which isn't supported).

Constructor

new SystemSpecificEntityResolver()

Name Description
system_specific_entity_path

Name Description
configure Configuration method.
put_system_specific_external_entity_replacement_file Puts a replacement file name or URI path to return as resolution result for the respective entity name.
put_system_specific_external_entity_replacement_stream Associates a readable stream to the specified name to be returned by subsequent calls to resolve_system_specific_entity_as_stream().
put_system_specific_external_entity_replacement_text Puts literal replacement character data to return as resolution result for the respective entity name.
resolve_external_subset_entity Returns the value previously registered via set_external_subset_entity for the given system_identifier and document_element/declaration subset name, or a default.
resolve_system_specific_external_entity Resolves `entity_ref` as system-specific entity reference relative to `base_system_identifier` and returns a system identifier which the caller can use to fetch the entity's data character content, if any.
resolve_system_specific_external_entity_as_stream Returns a readable stream previously registered with put_system_specific_external_entity_replacement_stream(), if any.
set_external_subset_entity Sets an extern subset entity for `resolve_external_subset_entity` to return.
set_system_specific_entity_path Sets `system_specific_entity_path`.

Member Details

configure(args)

Configuration method.

Parameters

Name Type Description
args Object.<string, string>

Map of configuration properties

put_system_specific_external_entity_replacement_file()

Puts a replacement file name or URI path to return as resolution result for the respective entity name.

put_system_specific_external_entity_replacement_stream()

Associates a readable stream to the specified name to be returned by subsequent calls to resolve_system_specific_entity_as_stream().

Note this functionality is isolated from other resolve_... functions, and is limited to handling the sgmlstdin stream.

put_system_specific_external_entity_replacement_text()

Puts literal replacement character data to return as resolution result for the respective entity name.

resolve_external_subset_entity()

Returns the value previously registered via set_external_subset_entity for the given system_identifier and document_element/declaration subset name, or [<system-specific-entity_path>/]<document_element>.dtd if no external subset entity was registered previously.

resolve_system_specific_external_entity(): string

Resolves entity_ref as system-specific entity reference relative to base_system_identifier and returns a system identifier which the caller can use to fetch the entity's data character content, if any.

Unless configured otherwise via put_system_specific_external_entity_replacement_text() or put_system_specific_external_entity_replacement_file(), this will just return the path string constructed by appending entity_ref (as file/URI path step) to base_system_identifier, and then made canonical/absolute (hence, this will only ever return an empty string value if it was explicitly put as replacement file name, which should be avoided).

System-specific entities having names beginning with SGML (case-insensitive) are considered "reserved" and used special:

sgmlstdin : is expected to be put (either via put_system_specific_external_entity_replacement_text() or put_system_specific_external_entity_replacement_file()) programmatically to contain literal or file-backed replacement content, resp., for entity references wrt. entities declared with FSI <osfd>0 to prevent OS-level stdin access; Tokenizer checks if the return value begins with <osfile> or is a plain (without storage manager notation) system identifier to distinguish the case that a file was explicitly put as opposed to being resolved by falling back to constructing a system identifier (which isn't useful/desired for sgmlstdin) : see also put_system_specific_external_entiy_replacement_stream() and resolve_system_specific_external_entity_as_stream()

Note that the returned result, if it is a path, will get resolved again (using resolve_system_identifier()) by Tokenizer; Tokenizer maintains a returned path by making it relative to the process-level current directory, so we but will get a request context base (the document) such that system identifier the .

Returns

string

a <literal> FSI from which data character content can be extracted directly; or an <osfile> FSI identifying a file from where to fetch data character content; or a system identifier without storage manager notation/tag identifying a resource from where to fetch data character content; NO: or the empty string, if no system specific external entity could resolved

resolve_system_specific_external_entity_as_stream()

Returns a readable stream previously registered with put_system_specific_external_entity_replacement_stream(), if any.

set_external_subset_entity()

Sets an extern subset entity for resolve_external_subset_entity to return.

set_system_specific_entity_path()

Sets system_specific_entity_path. UNUSED (system_specific_entity_path is set via configure())

system_specific_entity_path

path relative to which system-specific external entities and system identifiers of implied doctype are searched; set via configure()

// @private // can't be private (only) because of emulating sysid in error msg when // WORK_AROUND_MACOS_NAWK_IGNORING_STDIN_WHEN_USING_EXTENDED_COMMAND_LINE_ARGS