You can use the mapper functionality to combine the contents of two different schemas, as shown in the following figure:
Figure : Combining Data From Different Schemas
In this case, the customer information is merged with the line-items repeating element to form one combined XML document.
This example describes how to create a transformation which combines the data from two different XML Schemas. This example shows how to combine the XML sample data shown in the preceding figure. In this example, the source data is not constrained or limited to produce the target data—a where clause was not added to the for loop iterating over the purchase-order/line-items/line-items using the Constraints tab.
To Combine Data From Different Schemas
For this example, import the files: CustInfo.xsd and PO.xsd files. If you installed WebLogic Platform in the c:\bea directory, import these files from the c:\bea\weblogic81\workshop\help\doc\en\integration\reffiles\transform\dataDiffSchemas directory.
Note: The PO.xsd file used in this example is identical to the PO.xsd file used in Using the Union Option of the Constraints Tab. If you have already imported the PO.xsd file for the Using the Union Option of the Constraints Tab example, you do not need to import it again.
For this example, import the file: POCustInfo.xsd. If you installed WebLogic Platform in the c:\bea directory, import this file from the c:\bea\weblogic81\workshop\help\doc\en\integration\reffiles\transform\dataDiffSchemas directory.
Importing schemas files triggers a build of the current Schemas project folder. Wait until the current Schemas project folder is built before proceeding to the next step. (The representations of the schemas will not be available in Available Source Types and Available Target Type panes until build is complete.)
To select an existing method, in the Design View of the Transformation file:
The elements and attributes that make up the selected element are displayed in the Selected Source Types pane.
For this example, select and add the CustInfo.xsd/customer and PO.xsd/purchase-order nodes.
For this example, expand the POCustInfo.xsd schema folder.
For this example, select the POCustInfo.xsd/purchase-order element.
The elements and attributes that make up the selected element are displayed in the Selected Target Types pane.
The Design View of the XQ file is displayed.
For this example, link the $purchase_orderDoc/line-items/line-item repeating element to the purchase-order/line-items/line-item repeating element.
A dashed line linking the two repeating elements is displayed. The dashed line with short dashes represents a structural link—a link between two parent structures that does not map data directly. The dashed-line representation for a structural link is shown in the following figure:
To learn more about links, see Link Representations.
For this example, link the $purchase_orderDoc/line-items/line-item/part-no element to the purchase-order/line-items/line-item/part-no element. In addition, link the $purchase_orderDoc/line-items/line-item/quantity element to the purchase-order/line-items/line-item/quantity element.
Two solid lines linking the two subelements is displayed. These solid lines represents a data link—a link that converts the value of the source node directly to the value of the target node The solid line representation for a data link is shown in the following figure.
To learn more about links, see Link Representations.
A data link between the $customerDoc/customer-id node and the $purchase-order/customer/customer-id node is created.
A data link between the $customerDoc/customer-name node and the $purchase-order/customer/customer-name node is created.
A data link between the $customerDoc/customer-address node and the $purchase-order/customer/customer-address node is created.
The map between the source and target elements is shown in the following figure.
For this example, in the Source Data pane, select the $purchase_orderDoc node and import the file: InputPO.xml. In the Source Data pane, select the $customerDoc node and import the file: InputCust.xml. If you installed WebLogic Platform in the c:\bea directory, import these files from the c:\bea\weblogic81\workshop\help\doc\en\integration\reffiles\transform\dataDiffSchemas\XML directory.
Note: You can cut and past directory paths into the Name field of the Open File to Test pane to jump to directory locations. If you installed WebLogic Platform in the c:\bea directory, you can jump to the directory that contains the XML files for this example, by pasting the following directory path into the Name field: c:\bea\weblogic81\workshop\help\doc\en\integration\reffiles\transform\dataDiffSchemas\XML and then pressing enter.
If not currently running, the WebLogic Server for the current application will be started. In order for a query to run, the WebLogic Server for the current application must be running.
In the Result Data pane, after the query is run a graphical representation of the target data is displayed.
![]() |
![]() |