Defining Complex
Condition in choice Condition
Using Native format builder we can pick different
kind of records from flat file.
Sample file:
016404460A TCHAPRASTE VASKEN M19480901016404460D 120A86 200305
201308 967465840040 E
016463006ABARLLESLEYAF19541129016463006P120B1161
2013012013050005245020130501049000000000{
967459010010 0001031458310485698TBIDDLE MARILYN JF19450807310485698 120C2361 307322486D 20130320130330 0001282100575470305A PARK YOUNG OF19470823575470305P 120D3061 201203 2013033060048 020 0001282324
Native Data Format to Be
Translated:
The
choiceCondition
construct
is used along with the conditionValue construct for records that are complex
and may have fields delimited by fixed length. The other choiceCondition types
available are FixedLength
, Variable
. The
following example is for the variable choiceCondition type.
Native Schema:
<?xml
version="1.0" encoding="UTF-8" ?>
<xsd:schema
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:nxsd="http://xmlns.oracle.com/pcbpel/nxsd"
xmlns:tns="http://TargetNamespace.com/filewrite"
targetNamespace="http://TargetNamespace.com/filewrite"
elementFormDefault="qualified"
attributeFormDefault="unqualified"
nxsd:version="NXSD"
nxsd:stream="chars"
nxsd:encoding="US-ASCII"
>
<xsd:element
name="Root-Element">
<xsd:complexType>
<xsd:choice minOccurs="0"
maxOccurs="unbounded" nxsd:choiceCondition="${X}"
nxsd:lookAhead="75" nxsd:scanLength="1"
nxsd:assignTo="${X}">
<xsd:element
name="RecordA" type="tns:RecordIdentificationCodeAType"
nxsd:conditionValue="A" />
<xsd:element
name="RecordB" type="tns:RecordIdentificationCodeBType"
nxsd:conditionValue="B" />
<xsd:element
name="RecordC" type="tns:RecordIdentificationCodeCType"
nxsd:conditionValue="C" />
<xsd:element
name="RecordD" type="tns:RecordIdentificationCodeDType"
nxsd:conditionValue="D" />
</xsd:choice>
</xsd:complexType>
</xsd:element>
<xsd:complexType
name="RecordIdentificationCodeAType">
<xsd:sequence>
--------------------
---------------------------------
</xsd: sequence>
</xsd:complexType>
<xsd:complexType
name="RecordIdentificationCodeBType">
<xsd:sequence>
--------------------
---------------------------------
</xsd: sequence>
</xsd:complexType>
<xsd:complexType
name="RecordIdentificationCodeCType">
<xsd:sequence>
--------------------
---------------------------------
</xsd: sequence>
</xsd:complexType>
<xsd:complexType
name="RecordIdentificationCodeDType">
<xsd:sequence>
--------------------
---------------------------------
</xsd: sequence>
</xsd:complexType>
Translated XML Using
Native Schema:
<?xml version
= '1.0' encoding = 'UTF-8'?>
<Root-Element
xmlns="http://TargetNamespace.com/filewrite">
<RecordA></RecordB>
<RecordB></RecordB>
<RecordC></RecordC>
<RecordD></RecordD>
</Root-Element>