File Content Extraction 25.1
XML Export SDK Java Programming Guide

# Run Export Out-of-Process

The `XmlTest.java` sample program demonstrates how to run Export out-of-process.

To convert files out-of-process in the Java API

1. If required, set parameters for the out-of-process conversion in the `formats_e.ini` file. See Configure Out-of-Process Conversions.

2. Create an instance of the `XmlExport` class.

       XmlExport objXmlExport = new XmlExport("YOUR_KEYVIEW_LICENSE");

3. If you are using a template file to set the conversion options, call the `setIniFileName` method.

       objXmlExport.setIniFileName(iniFile);

4. If you are using the API to set the conversion options, create instances of the following classes:

       XmlTemplateInfo
       XmlOptionInfo
       XmlTOCOptionInfo
       StyleMapping
       XmlHeadingInfo

   Set the classes to the current `XmlExport` object using the appropriate set methods. If you do not set the classes before calling the `startOOPSession` method, default values are used.

5. Set the location of the Export libraries by calling the `setExportDirectory` method. These are normally in the directory `install\OS\bin`, where `install` is the path name of the Export installation directory and `OS` is the name of the operating system.

       objXmlExport.setExportDirectory(exportDir);

6. Optionally, set the input source as either a file or stream by calling the `setInputSource` method.

       // set the input source as a file
       objXmlExport.setInputSource(inFile);

       // or set the input source as a stream
       inf = new File(inFile);
       fis = new FileInputStream(inf);
       objXmlExport.setInputSource(fis);

   The `setInputSource` method also accepts a `com.verity.api.SeekableInputStream`. OpenText recommends that you use this option, because it allows File Content Extraction to seek in the file, only reading the parts it needs to read. If you need to use a Java `InputStream`, and you know the stream length, there is a method overload that allows the size to be passed in. Using this might allow File Content Extraction to avoid caching the whole file. For more information, see Input/Output Operations.

7. Set up an out-of-process session by calling the `startOOPSession` method. This initializes the out-of-process session, creates a Servant process, establishes a communication channel between the application thread and the Servant, and sends the data to the Servant.

       objXmlExport.startOOPSession();

8. Convert the input and generate the output files by calling the `convertTo` method. You cannot use the `convert` methods that set the input source because the input source must be set before the out-of-process session is initialized. The `convertTo` method can only be called once in a single out-of-process session.

       objXmlExport.convertTo(outFile);

9. Terminate the out-of-process session by calling the `endOOPSession` method. The Servant ends the current conversion session, and releases the source data and session resources.

       objXmlExport.endOOPSession(TRUE);

10. Repeat Step 3 through Step 9 for additional files.

11. After all files are converted, terminate the out-of-process session and the Servant process by calling `endOOPSession` and setting the Boolean to `FALSE`.

        objXmlExport.endOOPSession(FALSE);

12. Terminate the Export session and free allocated system resources by calling the `shutdownExport()` method.

        m_objExport.shutdownExport();

Copyright 1997-2024 Open Text
Version 25.1 | Last updated January 2025

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 25.1

Topic Title: Run Export Out-of-Process