How To Generate An XML File As A Target Datastore Using ODI In An Integration Interface ? [ID 454268.1] | |||||
| |||||
Modified 12-SEP-2011 Type HOWTO Status PUBLISHED |
In this Document
Goal
Solution
Step 1 : Interface 1
Step 3 : Create a Specific Procedure called "Create the XML File"
Step 4 : Create an ODI Package to run the process
References
Applies to:
Oracle Data Integrator - Version: 3.2.03.01 and later [Release: 3.2.03 and later ]Information in this document applies to any platform.
Goal
How to generate an XML file as a target Datastore using ODI in an Integration Interface ?
Is it necessary to create a generic XML template (DTD or XSD) and set it as a target?
Are there any specific Knowledge Modules to use in this case ?
Do we need to create ODI Integration Interfaces for each datastore and create the XML file using the procedure ?
Solution
To do this, either a DTD or XSD file is necessary (Note:424669.1). This is the best practices approach.
- In Topology Manager, create a Data Server under the XML Technology (in Physical Architecture). You may duplicate the sample GEO_DIM one already present and modify the URL so it points to your DTD (or XSD file).
- Delete the Physical Schema that is attached to the duplicate Data Server, and insert a new one.
- Create a Logical Schema which points to the Physical Schema for your particular Context.
- In Designer Tool, reverse the XML Model (from the Logical Schema created in the preceding step) and you will observe that this operation creates a number of tables from the DTD (or XSD) you provided.
- You can then set up Integration Interfaces to create the targeted XML file as you do with Datastores created on any RDBMS technology. You can use the SQL based KMs. LKM Sql to Sql and IKM Sql Control Append (See also Note:451926.1).
Your URL in the Topology Manager > Physical Architecture > Data Server should look like (for example) :
jdbc:snps:xml?d=...MyDTD.dtd&s=MySchema&dod=true.....
Please consult the documentation of ODI XML Driver for more details concerning the proposed parameters.
Observe the Datastores that you generate from the Reverse Engineering process and you will notice how the XML hierarchy has been transformed into a set of relational tables (or Datastores) that are inter-related with PKs and FKs. When populating the targeted XML, you are required to ensure that the integrity constraints are not violated.
Note that *at least* 2 Integration Interfaces are required to create a targeted XML file (in the case that you have a flat hierarchy) :
- The first one creates the ROOT node to the targeted XML
- The subsequent Integration Interfaces which create the following (descending) hierarchical levels of the XML file. You will then require 1 Integration Interface per hierarchical level of the XML structure.
For example, using the IKM Sql Control Append Knowledge Module :
Step 1 : Interface 1
Using a source Datastore (for example a relational table in an Oracle database) to target the root table of your XML instance file.
- rootTableNamePK column is mapped to 0.
- SnpsFileName mapped to source name (technical fields - not mandatory).
- SnpsFilePath fields mapped to source path (technical fields - not mandatory).
- SnpsLoadDate can be sysdate (technical fields - not mandatory).
Step 2 : Interface 2
Load the child of the ROOT table (Datastore) and make sure that :
- parentTableNameFK is mapped to 0 and
- childTableNamePK is mapped to a source column that uniquely identifies each row of this child table.
Step 3 : Create a Specific Procedure called "Create the XML File"
Create a Specific Procedure which will contain 2 command lines (or steps).
- Insert Step (of Technology XML) using the Logical Schema used to create your XML Model to truncate the the Schema :
TRUNCATE SCHEMA MySchema
- Insert another Step (of Technology XML) using the Logical Schema used to create your XML ModelInsert another Step (of Technology XML) using the Logical Schema used to create your XML Model to truncate the the Schema :
CREATE XMLFILE "...MyXMLFile.xml" FROM SCHEMA MySchema
Step 4 : Create an ODI Package to run the process
Create an ODI Package with the following order of appearance in the flow :
- Interface 1
- Interface 2
- Create the XML File.
Please consult the documentation for the ODI XML Driver that uses a concrete example to explain the relationship between the reversed XML Datastores.
In this additional approach, the targeted XML file should have its own XML Schema created from a DTD (or XSD) connection (for example) :
jdbc:snps:xml?d=......\GEO_DIM.dtd&dod=true
You will also need to have an Integration Interface to load the root GEOGRAPHY_DIM table first.
In this case, set GEOGRAPHY_DIM in the Knowledge Module root_table option.
In the Integration Interface, the Source may be empty, and the Target is GEOGRAPHY_DIM.
Then create subsequent Interfaces to load the remaining elements of the XML hierarchy you are creating.
In the last Integration Interface in the including Package, set the create_xml_file KM option to true.
References
NOTE:424346.1 - Recommendations For Starting ODI Operations With XML Files And The XML DriverNOTE:424669.1 - Best Practices When Using DTDs And XSDs With XML Files And The ODI XML Driver
NOTE:451926.1 - Which Knowledge Modules May Be Used To Load Data Into Target XML Files With The ODI XML Driver?
Related Products
|