Removing or Adding Namespaces to XML with No Namespace Defining the Choice Condition Schema for a Complex File Structure

Native Format Builder Wizard 6-95 For more information about creating a complex type, see Section 6.4.3, Defining the Schema for a Complex File Structure . The Native Format Builder Design Schema page is displayed, as shown in Figure 6–46 . Figure 6–46 Native Format Builder Design Schema Page

3. Click Add Choice Node. The Choice Option Type dialog is displayed.

4. Set the options in the Choice Option Type dialog, as shown in

Figure 6–47 , and then click OK. Figure 6–47 The Choice Option Type Dialog

5. Select choice and click the Add Element icon. A new_element is added to the

choice node. 6. Rename the newly added element to OrderChoice, and then drag and drop the OrderType complex type element to OrderChoice. 6-96 Oracle Fusion Middleware Users Guide for Technology Adapters

7. Select OrderChoice - string and click the Edit Node icon. The Element Details

dialog is displayed. 8. Enter Order in the Choice Value field, as shown in Figure 6–48 , and then click OK . Figure 6–48 The Element Details Dialog 9. Follow Step 5 to 8 to create the ItemChoice choice complex type with ItemType data type and CustomerChoice choice complex type with CustomerType data type. The Native Format Builder Design Schema dialog is displayed, as shown in Figure 6–49 . Figure 6–49 Native Format Builder Design Schema Page

10. Click Next. The Generated Native Format Schema File page is displayed, as shown

in Figure 6–50 , which displays the native format file. Note: You should specify four characters in Choice Value field as the Length field has the value 4 in it. Native Format Builder Wizard 6-97 Figure 6–50 Generated Native Format Schema File Page Native Schema The native schema definition corresponding to the preceding native data can be defined as follows: ?xml version=1.0 encoding=UTF-8 ? xsd:schema xmlns:xsd=http:www.w3.org2001XMLSchema xmlns:nxsd=http:xmlns.oracle.compcbpelnxsd xmlns:tns=http:TargetNamespace.comtest targetNamespace=http:TargetNamespace.comtest elementFormDefault=qualified attributeFormDefault=unqualified nxsd:version=NXSD nxsd:stream=chars nxsd:encoding=ASCII xsd:element name=Root-Element xsd:complexType xsd:choice minOccurs=1 maxOccurs=unbounded nxsd:choiceCondition=fixedLength nxsd:length=4 xsd:element name=OrderChoice type=tns:OrderType nxsd:conditionValue=Orde xsd:element name=ItemChoice type=tns:ItemType nxsd:conditionValue=Item xsd:element name=CustomerChoice type=tns:customerType nxsd:conditionValue=Cust xsd:choice xsd:complexType xsd:element xsd:complexType name=customerType xsd:sequence xsd:element name=C1 type=xsd:string nxsd:style=terminated nxsd:terminatedBy=, xsd:element name=C2 type=xsd:string nxsd:style=terminated nxsd:terminatedBy=, xsd:element name=C3 type=xsd:string nxsd:style=terminated nxsd:terminatedBy={eol} 6-98 Oracle Fusion Middleware Users Guide for Technology Adapters xsd:sequence xsd:complexType xsd:complexType name=ItemType xsd:sequence xsd:element name=C1 type=xsd:string nxsd:style=terminated nxsd:terminatedBy=, xsd:element name=C2 type=xsd:string nxsd:style=terminated nxsd:terminatedBy=, xsd:element name=C3 type=xsd:string nxsd:style=terminated nxsd:terminatedBy=, xsd:element name=C4 type=xsd:string nxsd:style=terminated nxsd:terminatedBy={eol} xsd:sequence xsd:complexType xsd:complexType name=OrderType xsd:sequence xsd:element name=C1 type=xsd:string nxsd:style=terminated nxsd:terminatedBy=, xsd:element name=C2 type=xsd:string nxsd:style=terminated nxsd:terminatedBy=, xsd:element name=C3 type=xsd:string nxsd:style=terminated nxsd:terminatedBy={eol} xsd:sequence xsd:complexType xsd:schema

11. Click Test. The Test NXSD Schema dialog is displayed.

12. Click the Generate XML icon. The Result XML is displayed on the right pane of

the Test NXSD Schema dialog, as shown in Figure 6–51 . Figure 6–51 Test NXSD Schema Dialog Translated XML Using the Native Schema Native Format Builder Wizard 6-99 The translated XML looks as follows: ?xml version = 1.0 encoding = UTF-8? Root-Element xmlns=http:TargetNamespace.comtest OrderChoice C1rC1 C2 ID41678C2 C3 20May2000C3 OrderChoice ItemChoice C11C1 C2 GigaWidgetC2 C3 60C3 C4 75C4 ItemChoice ItemChoice C12C1 C2 MegaBucketC2 C3 48C3 C4 125C4 ItemChoice CustomerChoice C11C1 C2 Hopkins AssociatesC2 C3 ID26490C3 CustomerChoice OrderChoice C1rC1 C2 ID41680C2 C3 20May2000C3 OrderChoice ItemChoice C13C1 C2 Rt.ClopperC2 C3 40C3 C4 100C4 ItemChoice ItemChoice C14C1 C2 Lt.ClopperC2 C3 50C3 C4 100C4 ItemChoice CustomerChoice C12C1 C2 Jersey WebInovatersC2 C3 ID46786C3 CustomerChoice Root-Element

13. Click OK. The Generated Native Format File page is displayed.

14. Click Next. The Native Format Builder Finish page is displayed.

6.4.6 Defining Choice Condition With LookAhead for a Complex File Structure

In this use case, the Native Format Builder uses address.txt, a complex type file, which contains multiple records with different addresses. In this use case, you would build a schema which has 2 record types. The RecOne record takes data for records 6-100 Oracle Fusion Middleware Users Guide for Technology Adapters ending with text YES and the RecTwo record takes data for records ending with text NO . Also, using this use case you can generate the NXSD and test it. Perform the following steps to run this use case: 1. The data in a sample text file, address.txt, appears as below: Name1,2 Old Street, Old Town,Manchester,20-08-1954,0161-499-1718, YES Name2,2 Old Street, Old Town,Manchester,20-08-1954,0161-499-1718, NO Name3,2 Old Street, Old Town,Manchester,20-08-1954,0161-499-1718, NO Name4,2 Old Street, Old Town,Manchester,20-08-1954,0161-499-1718, YES 2. Launch the Adapter Configuration Wizard and navigate to the Messages page, and click Define Schema For Native Format. The Native Format Builder Welcome page is displayed.

3. Click Next. The Choose Type page is displayed.

4. Select Complex Type and click Next. The Native Format Builder File Description

page is displayed.

5. Click Browse and select the address.txt file, and enter Address in the Root

Element field.

6. Click Next. The Native Format Builder Design Schema page is displayed.

7. Click the Add Complex Type icon. A Complex Type, new_complex_type is

created in the Schema Tree under Address. 8. Select the first row of the sample text from the right-hand pane of the Sample File section, and drag and drop it on the new_complex_type node. The Complex Type Details dialog is displayed.

9. Enter RECORD1 in the Complex Type Name field and select Comma , in the

Delimited By list.

10. Click OK. The Native Format Builder Design Schema page is displayed, as shown

in Figure 6–52 . Figure 6–52 Native Format Builder Design Schema Page