Tuesday, June 10, 2025

OIC - Line-by-Line Data Parsing in OIC Using Custom XSD Schema

Use Case:

When handling files containing rowwise data, such as payment information, it’s crucial to accurately parse each row based on a delimiter—like end-of-line (EOL). In this scenario, the incoming file data is represented in an XML format, where rows (or records) are wrapped within the XML structure and separated by EOL. To enable seamless integration and processing in Oracle Integration Cloud (OIC), we define a custom XSD schema to parse each row correctly and handle these line breaks.


Solution Steps:

✅ 1 Create the XSD Schema for Rowwise Parsing
We’ve designed an XSD schema (payments.xsd) with the following key features:

  • The root element <payments> contains multiple <MyDataSet> elements.
  • Each <MyDataSet> represents a row of data and uses nxsd:cellSeparatedBy="${eol}" to handle EOL-separated entries.
  • Each row contains a single <MyData> element representing the data in that line, with nxsd:style="terminated" and nxsd:terminatedBy="${eol}" to ensure accurate row termination.
<?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://xmlns.sky.com.mx/sib/FormateaEfectivoPagosAnticipados/OficinaNICRFAdptr"
    targetNamespace="http://xmlns.sky.com.mx/sib/FormateaEfectivoPagosAnticipados/OficinaNICRFAdptr"
    elementFormDefault="qualified"
    attributeFormDefault="unqualified"
    nxsd:version="NXSD"
    nxsd:stream="chars"
    nxsd:encoding="UTF-8">

    <xsd:element name="payments">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element name="MyDataSet" nxsd:cellSeparatedBy="${eol}" minOccurs="1" maxOccurs="unbounded">
                    <xsd:complexType>
                        <xsd:sequence>
                            <xsd:element name="MyData" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="${eol}" nxsd:quotedBy="&quot;" />
                        </xsd:sequence>
                    </xsd:complexType>
                </xsd:element>
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>

</xsd:schema>

✅ 2 Upload the XSD Schema in OIC

  • Navigate to OIC -> Artifacts -> XSD Schemas.
  • Upload the payments.xsd file to use it for validating and parsing incoming rowwise data files.

✅ 3 Integration in OIC

  • Use the File Adapter or REST Adapter to bring in the file as input.
  • Use the uploaded XSD to parse the file into structured data rows automatically.

Benefits of this Approach:

🔹 Accurate Rowwise Parsing – The schema ensures each line is treated as a separate record using EOL delimiters.
🔹 Easy Integration – Directly parse and validate rowwise data in OIC, reducing transformation complexity.


No comments:

Post a Comment

Featured Post

OIC - OIC Utility to Reprocess Failed Real-Time Integration JSON Payloads

📌 Use Case In real-time OIC integrations, JSON payloads are exchanged with external systems via REST APIs. When such integrations fail (du...