Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved


Chapter 2 Designing an OIG Application : Designing an XML Document

Designing an XML Document
XML Capabilities of OIG
Object Integration Gateway can both consume (read) and produce (write) XML documents.
In OIG, all XML documents are mapped to a set of database tables and their associated relational model. The OIG XML document definition is used to determine the structure of the XML document produced from the relational model by defining both the structure of the data and the formatting of the data. When the XML document is produced, only the initial data selection and the parent Gateway document definition are specified. The document definitions supply the data access specifications to navigate the data model. When an XML document is consumed, the OIG document definition is used to format the parsed data and enter the data into the associated databases.
*Re
For a detailed example, see “Creating XML Documents” on page 127.
XML Field Map
An XML field map has two complementary purposes. First, when an XML document is being produced, the field map is used to define what data is to be included in the document, and to determine how this data is represented in the document. Second, when an XML document is being consumed, the field map defines the way that data parsed from the document is processed and where the data is entered into the database.
Root Names for XML Document Tables
Every table within an XML document has a root name. Unlike the root name for an XML document, the root name element for a table will appear once for every row of the table being mapped. Fields of a row of a table can be mapped to attributes of the table root name or some sub-element of the table root name, except as described in , Restrictions That Apply to Tables with No Root Name. The following sections contain examples for your use.
Example 1
In the example below, a single table is mapped to an XML document. The element “employees” is the root name of an XML document and “employee” is a table root name.
 
<?xml version=”1.0”?>
<employees>
<employee>
<empno>80002</empno>
<lname>SMYTHE</lname>
</employee>
<employee>
<empno>80003</empno>
<lname>CHANG</lname>
</employee>
<employee>
<empno>80004</empno>
<lname>GARZA</lname>
</employee>
</employees>
Example 2
There are circumstances where an XML document required less structure. Such documents can be consumed or produced by mapping a table with a single row and not specify root name for the table. The following example shows this structure: PolicyOwner is the root name of the XML document, followed by only the field name Value.
 
<?xml version="1.0" ?>
<PolicyOwner>
<Value>Fred Smith</Value>
</PolicyOwner>
Example 3
Within a single XML document you can specify one table with only one row as well as multi-row tables, as shown in the following example:
 
<?xml version="1.0" ?>
<PartRequest>
<PartCount>2</PartCount>
<Part>
<Number>874jq</Number>
<Description>Cylinder head</Description>
</Part>
<Part>
<Number>860jq</Number>
<Description>Valve</Description>
</Part>
</PartRequest>
Restrictions That Apply to Tables with No Root Name
The following restrictions apply to specifying a table with no root name in your XML document:
The fields of a table with no root name cannot be mapped to attributes. This is true because the root element of an XML document cannot have attributes.

Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved