This example shows how to create mappings with schemas that have recursive elements. A recursive element contains a child element of the same type as the parent as shown in the following example XML Schema listing:
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.acme.org/Product"
xmlns="http://www.acme.org/Product" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:complexType name="productType">
<xs:sequence>
<xs:element name="part-description" minOccurs="0" maxOccurs="unbounded" type="xs:string" />
<xs:element name="child-product" minOccurs="0" maxOccurs="unbounded" type="productType" />
</xs:sequence>
</xs:complexType>
<xs:element name="product" type="productType">
</xs:element>
</xs:schema>
In this example, the product element is a recursive element because it is of type: productType and productType contains a child-product element which is also of type productType (productType refers to itself) as shown in bold in the preceding code listing.
Figure : Non-Recursive Source Elements to a Recursive Target Element
To Create and Run a Transformation Between a Non-Recursive Source Elements and a Recursive Target Element
For this example, import the files: SupplierAcme.xsd and Product.xsd files (step 2 in General Steps to Open or Create a Query in the Mapper.) 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\recursive directory.
For this example, select and add the SupplierAcme.xsd/supplier-acme node as an source type (step 4 in General Steps to Open or Create a Query in the Mapper.)
For this example, select and add the Product.xsd/product node as an target type (step 4 in General Steps to Open or Create a Query in the Mapper.)
The product node is displayed with one level of the recursive child-product node expanded as shown in the following figure.
Another child node appears under the second-level child-product node as shown in the following figure.
For this example, in the Source Data pane, select the $supplier_acmeDoc node and import the file: InputRecursive.xml. 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\recursive\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\recursive\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, a graphical representation of the target data is displayed.
![]() |
![]() |