gxluSetEntityResolver — specify the entity resolver for OSR generation

Description

This utility allows the caller to specify an entity resolver to the OSR generator. This resolver must be written in Java™.

Performance Implications

There are no performance implications.

Syntax

int gxluSetEntityResolver(void * oima_p,
                   char * class_name_p,
                   int *  rc_p,
                   int * rsn_p)

Parameters

oima_p
Supplied parameter
Type:
void *

A pointer to an OSR generator Instance Memory Area (OIMA).

class_name_p
Supplied parameter
Type:
char *

A pointer to the NULL terminated name of a Java class that implements the XMLEntityResolver interface of the XML4J parser (see the usage notes below). This string must be in the IBM-1047 code page. A NULL string indicates that the current entity resolver should be unset, and the default resolver used during the creation of the OSR.

rc_p
Returned parameter
Type:
int *

A pointer to an area where the utility stores the return code.

rsn_p
Returned parameter
Type:
int *

A pointer to an area where the utility stores the reason code. The reason code is only relevant if the return code is not XRC_SUCCESS.

All parameters in the parameter list are required.

Return Value:

The value returned by this service is return code (see below).

Return and Reason Codes:

On return from a call to this utility, register 15 will contain the return code. The return and reason code are both also set as output parameters. The value of the reason code is undefined when the return code has no associated reasons. Return and reason codes are defined in the header file gxlhxr.h (see gxlhxr.h (GXLYXR) - defines the return codes and reason codes). For reason code descriptions, also see Reason codes listed by value.

Example

#include <stdlib.h>
#include <stdio.h>
#include <gxlhosrg.h>
#include <gxlhxec.h>

void *        oima_p;
unsigned long oima_l;
char          handler_parms[128];
char          class_name[SIZE]  = "xml/appl/handlers/EntityResolver";
int           rc, rsn;

if (oima_p = malloc(GXLHXEC_MIN_OIMA_SIZE))
      { /* oima malloc succeeded   */
      oima_l = GXLHXEC_MIN_OIMA_SIZE;

 gxluInitOSRG(oima_p, oima_l,
         0,
         (void *)handler_parms,
         &rc, &rsn);
    }  /* oima malloc succeeded   */

/* Now set an entity resolver that will be used during  */
/* OSR generation.                                      */

if ((oima_p > 0) && (rc == GXLHXRC_SUCCESS))
    {  /* generator initialized */
    gxluSetEntityResolver(oima_p,
                 class_name,
                 &rc, &rsn);

    if (rc == GXLHXRC_SUCCESS)
       { /* set resolver succeeded   */

       <continue processing using the entity resolver>
      
         ...
       }  /* set resolver succeeded   */
    
      ...
      } /* generator initialized */ 

Usage notes

Although this is a C interface, the entity resolver must be implemented in Java. This resolver will be provided to the XML4J parser, which is used during the OSR generation process. The resolver must implement the XMLEntityResolver interface of the Xerces Native Interface (XNI), including the return of an XMLInputSource object. See the XMLEntityResolver documentation at http://xerces.apache.org/xerces2-j/javadocs/xni/index.html.

This routine may be called more than once during an OSR generation instance to change the entity resolver that the generator uses.