function
Library: Markup utilities (OMMARKUPUTILITIES)
Import : ommarkuputilities.xmd |
Returns: |
export dynamic markup sink function external-entity-resolver via value entity-resolver resolver stack value parsed-entity-stack entity-stack optional
The markup sink function external-entity-resolver
resolves all external entity reference events
written to it, and feeds their resolved values to the parser. This function is dynamic
and can be
overridden. It will throw resolution-failure
if it cannot resolve an entity.
The optional entity-stack argument can be supplied to the function in order to keep track of the chain of entities that are currently being read and parsed. This can be useful for error reporting.
The following example uses split-external-text-entities
to direct all entity references to external-entity-resolver
and all other markup events to the function worker
.
import "ommarkuputilities.xmd" unprefixed define markup sink function worker as using output as #main-output do markup-parse #current-input output "%c" done process do xml-parse document scan #main-input using output as split-external-text-entities (external-entity-resolver via new entity-resolver {}, worker) output #content done