# Convert Availability List to XML Quote Document

Complete the following steps to design a node to transform the availability list (created as a result of iteration through the For Each loop) to a variable whose data type is typed-XML. To do so, you use methods on the priceAvailTransformations control.

To Design the Interaction With the Transformation Control

1. Expand the priceAvailTransformations control instance in the Data Palette, then click the following method:

AvailQuoteDocument convertAvailListToXML(com.bea.xml.XmlObjectList _XmlObjectListDoc)

2. Drag the method from the Data Palette and drop it on your RequestQuote business process in the Design View, placing it immediately after the Convert PriceList to PriceQuote XML node.

3. Rename the node from convertAvailListToXML to Convert AvailList to AvailQuote XML.
4. Double-click the Convert AvailList to AvailQuote XML node to open its node builder.
5. Verify that the priceAvailTransformations control and the following method are selected on the General Settings tab:

    AvailQuoteDocument convertAvailListToXML(com.bea.xml.XmlObjectList _XmlObjectListDoc)

6. Click Send Data to open the second tab in the node builder.

The Control Expects field is populated with XmlObjectList, which is the data type expected by the convertAvailListToXML() method on the priceAvailTransformations control.

7. On the Send Data tab, under Select variables to assign, click the arrow in the variable assignment field, and select availList (XmlObjectList).
8. Click Receive Data to open the third tab in the node builder.

The Control Returns field is populated with AvailQuoteDocument, which is the data type returned by the convertAvailListToXML() method on the priceAvailTransformations control.

9. Click the arrow associated with the Select variables to assign field, and click Create new variable .... The Create Variable dialog box is displayed.
10. In the Variable Name field, enter availQuote.

11. In the Select Variable Type field, click the + beside AvailQuote.xsd in the XML Types list, then select availQuote from the list. The Variable Type field is populated with org.example.avail.AvailQuoteDocument.
12. Click OK to close the Create Variable dialog box.
13. To close the node builder, click the X in the top right-hand corner.

This step completes the design of the Convert AvailList to AvailQuote XML node. At run time, the availability quote data in XML format are assigned to the availQuote variable.

Note About the Transformation on This Node

The convertAvailListToXML() method on the priceAvailTransformations control does the work of creating the availability quote XML data. The input to convertAvailListToXML() is the availability data returned by the availProcessor control after the iterations in the For Each node complete.

You can double-click PriceAvailTransformations.dtf in the Application pane to display the Transformation control in Design View. Right click on convertAvailListToXML method, and select Go to XQuery Document to open the Transformation tool. The following figure shows the map for the convertAvailListToXML() method:

The preceding figure shows the transformation of the data in a variable of type XmlObjectList, which contains a repeating set of untyped XML data, to the repeating element in an XML-typed variable. Note that to achieve this transformation, the repeating element in the target schema must be the single child of a root element. In this case, availRequest is the repeating element, and it is the single child of the availQuote element. Click the Source View tab in the Transformation tool to see the corresponding XQuery.