The XML to Forms conversion tool, XML2Forms
, converts an XML file
to a Forms Module. Typically, you will use this conversion tool to convert an
XML file that was initially created by the Forms2XML
tool. However, it can also be used to convert a Forms XML file that
came from another source, or that you have written from scratch. For example,
you could write your own Forms XML file, use the XML validation tool XMLValidator
to check it for correctness, then use XML2Forms
to convert it to
a Forms Module.
XML2Forms
uses the Oracle XDK's SAXParser implementation to parse
the XML and uses the Forms XML Schema
to validate it. For each element it encounters, including the FormModule
element itself, the conversion tool creates a new Forms Object and sets the
properties for each attribute. Any child elements are created as new Forms Objects
using the correct owner.
Note: if you
modify the XML with a utility or under an operating system (such as Windows
95) that does not support the UTF-8 unicode character set, then the file will
be corrupted. The XML2Forms
conversion tool will produce incorrect
results.
If you edited your XML without using the Oracle XDK (for example, if you are
using your own XML parser or software, or if you are using the public domain
org.w3c/org.xml
classes), you must ensure that illegal characters
(for example, >, <, &, and so on) do not occur in your code. See HTML
Substitutions for Illegal Characters for the list of character substitutions
that you will have to make.
There are some special cases in the Forms Object hierarchy for which you will need to add additional code to your XML:
DataSourceColumn
and DataSourceArgument
objectsthese
objects are created in JDAPI with a NAME
property that is
the Forms Object Id for the particular type of DataSourceColumn
/Argument
.
If you create a DataSourceColumn
or DataSourceArgument
in the XML, you must provide a Type
attribute. This attribute
corresponds to NAME
and describes which of the five types the
object is. The allowed values for Type
are: Insert
,
Update
, Delete
, Lock
and Query
.
This is validated by the Forms XML schema.
For example, the following XML code describes a block with one item for
the EMP table column EMPNO and the corresponding DataSourceArgument
of type Query
.
<Block Name="EMP"
RecordsDisplayCount="5" QueryDataSourceName="emp"
DirtyInfo="true"
ScrollbarWidth="9" ScrollbarLength="135"> <Item Name="EMPNO"
Height="14"
PromptAlign="Center" PromptAttachmentEdge="Top"
Prompt="Empno"
YPosition="40" XPosition="10"
Width="27"
TabPageName=""
PromptDisplayStyle="First Record"
ColumnName="EMPNO"
ItemsDisplay="0"
MaximumLength="5" DirtyInfo="true"
CanvasName="CANVAS2"
Required="true" DataType="Number"
ItemType="Text Item"
/> <DataSourceColumn
DSCScale="0"
DSCPrecision="4" DSCMandatory="true"
DSCLength="0"
Type="Query"
DSCType="NUMBER" DSCName="EMPNO"
DSCNochildren="false" /> </Block>
ObjectGroupChild
objectsan ObjectGroupChild
object simply points to another object in the Form via the ObjectGroupChildRealObject
property. This property is not exposed in the XML as it is an Object property.
The XML uses a combination of the Name
and Type
property to point to the object in the Form. The Type
property
is not a real Forms property, but included for the purpose of referring to
the real object.
If you create an ObjectGroupChild
in the XML, you must provide
a Type
attribute to record the type of Forms object the ObjectGroupChild
represents. The value of Type
can be any of the Forms objects
listed in XML Element Types for Forms
Objects.
For example, the following XML code describes a module containing an Object Group and a block called EMP which is in the Object Group as a child:
<Module version="101020001" xmlns="http://xmlns.oracle.com/Forms"> <FormModule Name="ONEBLOCK" MenuModule="DEFAULT&SMARTBAR" Title="MODULE1">
<Coordinate RealUnit="Point" DefaultFontScaling="true" CoordinateSystem="Real" CharacterCellWidth="5" CharacterCellHeight="14"/>
<Block Name="EMP" RecordsDisplayCount="5" QueryDataSourceName="emp" ScrollbarWidth="9" ScrollbarLength="135"> ..... </Block> <ObjectGroup Name="OBJECT_GROUP"> <ObjectGroupChild Name="EMP" Type="Block"/> </ObjectGroup> </FormModule> </Module>
Coordinate
objectsthese objects do not exist in the Forms
hierarchy in the same way as the other objects. They are not "owned"
by the module in JDAPI and are processed differently. In the XML they
appear as any other Forms object does.
In the Builder the Coordinate information for a module is modified by using
the property palette, and bringing up the Coordinate dialog. In the XML,
this information is represented as a Coordinate
element that
is a child of the FormModule
. It MUST be the first element
inside the FormModule
element. It is not a required element;
if you do not supply a Coordinate
then the default settings
for Forms are used (as with any normal property).
An example of the Coordinate
element is in the previous XML
example.
RecordGroup
objectsif your
XML contains RecordGroup
objects of type QUERY
,
a database connection is required to set the query statement. For this purpose,
the XML2Forms
command includes an option for setting the database
connection string.
If the RecordGroup
object has any child objects (RecordGroupColumns
),
you do not have to create them manually. Instead, they will be created automatically
by the setting of the query statement. When the XML is converted into a
Form, a database connection is required to accurately construct the child
objects.
For example, the following XML code describes a record group that has one column, ENAME from table EMP:
<RecordGroup Name="RECORD_GROUP2" RecordGroupFetchSize="10" RecordGroupType="Query" RecordGroupQuery="select ename from emp"/>
Items
of type List
, RecordGroupColumns
from a STATIC RecordGroup,
MenuModules
and MenuItems
these
objects all contain information that is not accessible from the standard String
,
Integer
, and Boolean
properties. This is the reason
that there are extra elements for these objects that are not normal Forms
Objects. These extra elements are, respectively: ListItemElement
,
RecordGroupColumnRow
, MenuModuleRole
, and MenuItemRole
.
For example, the following XML code displays an Item
of type
List
with corresponding test elements:
... <Item Name="ITEM10" Height="14" YPosition="88" XPosition="20" Width="45" ListElementCount="3" CanvasName="CV" ItemType="List Item"> <ListItemElement Index="1" Name="test1" Value="LIST16"/> <ListItemElement Index="2" Name="test2" Value="LIST17"/> <ListItemElement Index="3" Name="test3" Value="LIST18"/> </Item> ...
The following XML code displays a static record group column with values 1-3:
<RecordGroupColumn Name="VALUE1" ColumnDataType="Number" MaximumLength="30" ColumnValuesCount="3"> <RecordGroupColumnRow Index="3" Value="2"/> <RecordGroupColumnRow Index="2" Value="1"/> <RecordGroupColumnRow Index="1" Value="0"/> </RecordGroupColumn>
Using the XML to Forms Conversion Tool
Understanding the Generated XML
XML Element Types for Forms Objects