DEV Community

Naveen
Naveen

Posted on

STRUGGLING WITH IRREGULAR CSV FILES IN OIC? HERE’S THE NXSD SOLUTION

Handling non-uniform CSV/TXT files in Oracle Integration Cloud (OIC) is a common real-time integration challenge. These files often contain inconsistent structures like headers, mixed record types, or variable columns. This blog explains how to process such files using NXSD (Native Format Schema Definition) and trigger notifications effectively.

UNDERSTANDING THE CHALLENGE

Below is csv/txt file, which is Variable number of columns

Code,Message,Date
F,Hello,nj@gmail.com,957351,01-06-2026
S,Hey,ab@gmail.com,45466,02-06-2026
P,Bye,ck@gmail.com,87979,03-06-2026
Enter fullscreen mode Exit fullscreen mode

This kind of files we need to process in OIC with most effectively.

STEP 1: CREATE FLEXIBLE NXSD SCHEMA
NXSD enables parsing flat files into structured XML.

Note: Observe & understand the below script with respective the challenge mentioned.

<?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/fileReference/read"
            targetNamespace="http://TargetNamespace.com/fileReference/read"
            elementFormDefault="qualified"
            attributeFormDefault="unqualified"
            nxsd:version="NXSD"
            nxsd:stream="chars"
            nxsd:encoding="UTF8">

    <xsd:element name="Root-Element">
        <xsd:complexType>
            <xsd:sequence>

                <xsd:element name="headerset">
                    <xsd:complexType>
                        <xsd:sequence>
                            <xsd:element ref="tns:header"/>
                        </xsd:sequence>
                    </xsd:complexType>
                </xsd:element>

                <xsd:element name="lineset">
                    <xsd:complexType>
                        <xsd:sequence>
                            <xsd:element ref="tns:line" minOccurs="1" maxOccurs="unbounded"/>
                        </xsd:sequence>
                    </xsd:complexType>
                </xsd:element>

            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>
    <xsd:element name="header" type="tns:headerType"/>
    <xsd:element name="line" type="tns:lineType"/>
    <xsd:complexType name="headerType">
        <xsd:sequence>
            <xsd:element name="C1" type="xsd:string"
                         nxsd:style="terminated"
                         nxsd:terminatedBy=","
                         nxsd:quotedBy="&quot;"/>
            <xsd:element name="C2" type="xsd:string"
                         nxsd:style="terminated"
                         nxsd:terminatedBy=","
                         nxsd:quotedBy="&quot;"/>
            <xsd:element name="C3" type="xsd:string"
                         nxsd:style="terminated"
                         nxsd:terminatedBy="${eol}"
                         nxsd:quotedBy="&quot;"/>
        </xsd:sequence>
    </xsd:complexType>
    <xsd:complexType name="lineType">
     <xsd:sequence>
            <xsd:element name="C1" type="xsd:string"
                         nxsd:style="terminated"
                         nxsd:terminatedBy=","
                         nxsd:quotedBy="&quot;"/>
            <xsd:element name="C2" type="xsd:string"
                         nxsd:style="terminated"
                         nxsd:terminatedBy=","
                         nxsd:quotedBy="&quot;"/>
            <xsd:element name="C3" type="xsd:string"
                         nxsd:style="terminated"
                         nxsd:terminatedBy=","
                         nxsd:quotedBy="&quot;"/>
            <xsd:element name="C4" type="xsd:string"
                         nxsd:style="terminated"
                         nxsd:terminatedBy=","
                         nxsd:quotedBy="&quot;"/>
            <xsd:element name="C5" type="xsd:string"
                         nxsd:style="terminated"
                         nxsd:terminatedBy="${eol}"
                         nxsd:quotedBy="&quot;"/>               
        </xsd:sequence>
    </xsd:complexType>
</xsd:schema>
Enter fullscreen mode Exit fullscreen mode

Save the above script as XX_FILENAME.xsd

STEP 2: BUILD OIC INTEGRATION

  • Create Application Based Integration which accepts the request body as Binay Format.

  • Read file using stage action as below

Remember to upload your XSD file here as below in the stage read file operation

STEP 3: Write the file for Notification

  • Using stage action with Write Operation , write a file which has been read in the early step

  • make sure upload the same XSD file for sample data.

STEP 4: SEND NOTIFICATIONS

  • Hope we are familiar with OIC notification as below map data from write operation.

Finally, we read & write the non-uniform csv file in OIC successfully.

Note: ORACLE DOC reference for XSD Script

Top comments (0)