File Content Extraction 26.1
XML Export SDK C Programming Guide

# fpConvertStream()

This function converts either a source stream or file to an output stream.

## Syntax

      BOOL pascal fpConvertStream(
        void                *pContext,
        void                *pCallingContext,
        KVInputStream       *pInput,
        KVOutputStream      *pOutput,
        KVXMLTemplate       *pTemplates,
        KVXMLOptions        *pOptions,
        KVXMLTOCOptions     *pTOCCreateOptions,
        KVXMLCallbacks      *pCallbacks,
        BOOL                 bIndex,
        KVErrorCode         *pError );

## Arguments

`pContext` | A pointer to an Export session that you initialized by calling fpInit().
`pCallingContext` | A pointer passed back to the callback functions.
`pInput` | A pointer to the developer-assigned instance of `KVInputStream`. The `KVInputStream` structure defines the input stream that contains the source for the conversion. See KVInputStream.
`pOutput` | A pointer to the developer-assigned instance of `KVOutputStream`. The `KVOutputStream` structure defines the output stream to which Export writes the generated HTML. See KVOutputStream.
`pTemplates` | A pointer to the `KVXMLTemplate` data structure. It defines the overall structure of the output. Individual elements within the structure define the markup written at specific points in the output stream. See KVXMLTemplate. If this pointer is `NULL`, the default values for the structure are used.
`pOptions` | A pointer to the KVXMLOptions data structure. It defines the options that control the markup written in response to the general style and attributes (font, color, and so on) of the document. See KVXMLOptions. If this pointer is `NULL`, the default values for the structure are used.
`pCallbacks` | A pointer to the `KVXMLCallbacks` data structure. It is a structure of functions that Export calls for specific, user-defined purposes. See KVXMLCallbacks. If callbacks are not used, this can be `NULL`.
`pTOCCreateOptions` | A pointer to the `KVXMLTOCOptions` data structure. It specifies whether a heading is included in the table of contents. See KVXMLTOCOptions. If this pointer is `NULL`, the default values for the structure are used.
`bIndex` | Set `bIndex` to `TRUE` to generate output with minimal markup and without images. Because the generated output is minimized to textual content, it is suitable for an indexing engine. If you set `bIndex` to `FALSE`, embedded images in a document are regenerated as separate files and stored in the output directory. You can set this option through the `bIndexOnly` member of the `KVXMLOptions` structure. See KVXMLOptions. To generate output with verbose markup and without images, set the `nType` argument of the `KVXMLConfig()` function to `KVCFG_SUPPRESSIMAGES`. See KVXMLSetStyleSheet().
`pError` | A pointer to an error code if the call to `fpConvertStream()` fails.

## Returns

- If the call is successful, the return value is `TRUE`.

- If the call is unsuccessful, the return value is `FALSE`.

## Discussion

- Only `pContext`, `pInput`, `pOutput`, and `bIndex` are required. All other pointers should be `NULL` when they are not set.

- If `pCallbacksEx` is `NULL`, `pOptionsEx->pszDefaultOutputDirectory` must be valid, except when `bIndex` is set to `TRUE`.

- This function runs in-process or out-of-process. See Convert Files Out-of-Process.

- When converting out-of-process, this function must be called after the call to `KVXMLStartOOPSession()` and before the call to `KVXMLEndOOPSession()`. See KVXMLStartOOPSession() and KVXMLEndOOPSession().

- When converting out-of-process, the values for the `KVXMLTemplate`, `KVXMLOptions`, and `KVXMLTOCOptions` structures should be set to `NULL`. These structures are already passed in the call to `KVXMLStartOOPSession()`. See KVXMLStartOOPSession().

## Example

The following sample code is from the `cnv2xml` sample program:

    if(!(*KVXMLInt.fpConvertStream)(
                 pKVXML,        /* A pointer returned by fpInit()   */
                 NULL,          /* A pointer for callback functions */
                 &Input,        /* Input stream                   */
                 &Output,       /* Output stream                  */
                 NULL,          /* Markup and related variables  */
                 &XMLOptions,   /* Options                        */
                 NULL,          /* TOC options                    */
                 NULL,          /* A pointer to callback functions  */
                 FALSE,         /* Index mode                     */
                 &error))       /* Error return value             */
    {
       printf("Error converting %s to XML %d\n", argv[i - 1], error);
    }
    else
    {
        printf("Conversion of %s to XML completed.\n\n", argv[i - 1]);
    }

Copyright 1997-2025 Open Text
Version 26.1 | Last updated January 2026

Send documentation feedback

Close

Send documentation feedback

To send feedback using your default email client, open an email window.

Otherwise, send your feedback and the information below to MFI-swpdl.idoldocsfeedback@opentext.com.

We appreciate your feedback!

Product: File Content Extraction 26.1

Topic Title: fpConvertStream()