Beta Draft: 2016-09-08

3.2 Converting FormModules, ObjectLibraries, or MenuModules to XML

You can convert Oracle Forms FormModule, MenuModule, and ObjectLibrary files to Extensible Markup Language (XML) using the Oracle Forms to XML conversion tool, Forms2XML.

Note

The Forms2XML utility must generate an XML file in English only. If the generated XML tags are not in English, then the file will fail to load. The conversion of synonym-based data blocks is not supported. Only data blocks based on tables or views is supported by the conversion process. Please ensure that the application you want to convert is based only on tables and views.

3.2.1 About the Forms2XML Conversion Tool

The Oracle Forms to XML conversion tool, Forms2XML was introduced in Oracle9i Oracle Developer Suite and is also available in Oracle Developer Suite 10g. This tool should also work on files from earlier releases of Oracle Forms. If the Oracle Forms to XML Conversion tool does not work for a specific file from an earlier version of Oracle Forms, then you must upgrade the file to Oracle Developer Suite 9i or 10g and then convert to XML

Forms2XML produces an XML file that has the same base name as the Forms file with an .xml extension. The extension _fmb, _mmb, or _olb is added to the base file name to indicate whether the original file was a Forms Modules, a MenuModule, or an Object Library. The following table displays a few examples of the changes the tool makes to the name of the file being converted:


File name before conversion File name after conversion

myForm.fmb

myForm_fmb.xml

myMenu.mmb

myMenu_mmb.xml

myLibrary.olb

myLibrary_olb.xml


3.2.2 Using the Forms2XML Conversion Tool From a Command Line

The Forms2XML command takes one or more Forms Module files as an argument. The files can be FormsModule (.fmb), ObjectLibrary (.olb), or MenuModule (.mmb) files. The output is placed in the current folder. The command has the following syntax:

frmf2xml [options] file1 [file2...]
java oracle.forms.util.xmltools.Forms2XML [options] file1 [file2...]

The following table describes available options.


Options Description

USE_PROPERTY_IDS=YES/NO

Setting USE_PROPERTY_IDS to YES causes the Forms to XML conversion tool to write the internal ID for Real or Character into the XML file.

The default value (NO) generates property value names as before.

Note: The Forms2XML utility must be run with USE_PROPERTY_IDS=NO.

OVERWRITE=YES/NO

Valid values are YES or NO.

If OVERWRITE=YES, the tool overwrites any XML files with the same name that exist in the output directory.

If OVERWRITE=NO, (default) the tool does not overwrite any XML files with the same name that exist in the output directory. The tool will stop processing and return the message:

If the file file 1 exists, use argument OVERWRITE=YES to replace.

DUMP=ALL/OVERRIDEN

If DUMP=ALL, the tool dumps all properties.

If DUMP=OVERRIDEN, the tool dumps only those properties that are overridden.


3.2.3 Using the Forms2XML Conversion Tool in a Java Program

You can pass the Forms2XML tool a JdapiModule Java object (class oracle.forms.jdapi.JdapiModule) and dump its objects and properties to an XMLDocument (class oracle.xml.parser.v2.XMLDocument). For example:

...
 // get the modules in the session
 JdapiIterator mods = Jdapi.getModules(); 
    // ... and iterate round them 
    while(mods.hasNext())
      {
        JdapiModule mod = (JdapiModule)mods.next();
        Forms2XML converter = new Forms2XML(
        XMLDocument doc = converter.dumpModule(false);
              ... 
       }

The Boolean argument taken by the dumpModule() method instructs the converter to dump all properties to the XMLDocument doc, not just those which are overridden.

Once you have the module as an XMLDocument object, you could then use the XDK classes to manipulate it programmatically. For example, you could traverse it, remove or add objects, change properties, copy objects into other modules that are also saved as XMLDocument objects, and so on.

To learn more about Oracle Forms, see:

http://www.oracle.com/technetwork/developer-tools/forms/overview/index.html