Skip to Main Content

Integration

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Fixed length File

khaled bnJul 25 2024

I want to read a text file to output a JSON file.

The text file contains an array of objects called ‘SGA.’

Each ‘SGA’ object has a 2-character ID and an array of objects called ‘LG,’ which contains a single element: an amount represented by 3 characters.

The challenge is that each line can have a variable number of ‘LG’ arrays, ranging from 0 to 10.

this solution dont work

<?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://www.oracle.com/FTPAdapter"

  targetNamespace="http://www.oracle.com/FTPAdapter"

  elementFormDefault="qualified"

  attributeFormDefault="unqualified"

  nxsd:version="NXSD"

  nxsd:stream="chars"

  nxsd:encoding="US-ASCII">

  \<xsd:element name="SGAListe">

    \<xsd:complexType>

     \<xsd:sequence>

        \<xsd:element name="SGA" minOccurs="0" maxOccurs="unbounded" nxsd:style="array" nxsd:cellSeparatedBy="\\n" >

           \<xsd:complexType>

              \<xsd:sequence>

                 \<xsd:element name="id" type="xsd:string" nxsd:style="fixedLength" nxsd:length="2" nxsd:padStyle="tail"/>

                      \<xsd:element name="LG" maxOccurs="10" nxsd:style="array" >

                        \<xsd:complexType>

                          \<xsd:sequence>

                             \<xsd:element name="amount" type="xsd:string" nxsd:style="fixedLength" nxsd:length="3" nxsd:padStyle="tail" />

                          \</xsd:sequence>

                        \</xsd:complexType>

                      \</xsd:element>      

         \</xsd:sequence>

          \</xsd:complexType>    

        \</xsd:element>

         \</xsd:sequence>

          \</xsd:complexType>    

        \</xsd:element>

</xsd:schema>

Comments
Post Details
Added on Jul 25 2024
0 comments
46 views